From 86e36e899420ec1e31e22b13c7f5c4dbae2efd24 Mon Sep 17 00:00:00 2001 From: Hans Fredrik Nordhaug Date: Thu, 19 Dec 2019 14:28:06 +0100 Subject: [PATCH] Install config files in correct location (#51) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Install config files in correct location According to https://cmake.org/cmake/help/latest/command/find_package.html#search-procedure the config files should be *not* placed under /usr/share (which is what DATA_INSTALL_DIR gives you). Putting it one location under /usr/share makes it impossible to install for multiple libs (or archs). The provided patch is only tested under Linux and might need extension to work under Windows. (See link abode for Windows search path.) * Changing to lib/cmake/${projectname} Co-Authored-By: Ricardo González * Updated Windows packaging cmake template with new config directory. --- cmake/packaging/windows/fastcdr-config.cmake | 8 ++++---- src/cpp/CMakeLists.txt | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmake/packaging/windows/fastcdr-config.cmake b/cmake/packaging/windows/fastcdr-config.cmake index 79840b16..d13b6927 100644 --- a/cmake/packaging/windows/fastcdr-config.cmake +++ b/cmake/packaging/windows/fastcdr-config.cmake @@ -14,15 +14,15 @@ if(MSVC_VERSION EQUAL 1900) if(CMAKE_CL_64) - include("${CMAKE_CURRENT_LIST_DIR}/../share/fastcdr-x64Win64VS2015/cmake/fastcdr-config.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/../lib/cmake/fastcdr-x64Win64VS2015/fastcdr-config.cmake") else() - include("${CMAKE_CURRENT_LIST_DIR}/../share/fastcdr-i86Win32VS2015/cmake/fastcdr-config.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/../lib/cmake/fastcdr-i86Win32VS2015/fastcdr-config.cmake") endif() elseif(MSVC_VERSION GREATER 1900) if(CMAKE_CL_64) - include("${CMAKE_CURRENT_LIST_DIR}/../share/fastcdr-x64Win64VS2017/cmake/fastcdr-config.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/../lib/cmake/fastcdr-x64Win64VS2017/fastcdr-config.cmake") else() - include("${CMAKE_CURRENT_LIST_DIR}/../share/fastcdr-i86Win32VS2017/cmake/fastcdr-config.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/../lib/cmake/fastcdr-i86Win32VS2017/fastcdr-config.cmake") endif() else() message(FATAL_ERROR "Not supported version of Visual Studio") diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index ae7d85dd..c73d6a05 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -137,7 +137,7 @@ if(MSVC OR MSVC_IDE AND EPROSIMA_INSTALLER) endif() install(FILES ${PROJECT_SOURCE_DIR}/cmake/packaging/windows/${PROJECT_NAME}-config.cmake - DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME}/cmake + DESTINATION ${LIB_INSTALL_DIR}/cmake/${PROJECT_NAME}${MSVCARCH_DIR_EXTENSION_EXT} COMPONENT cmake ) elseif(NOT EPROSIMA_INSTALLER) @@ -154,7 +154,7 @@ elseif(NOT EPROSIMA_INSTALLER) if(INSTALLER_PLATFORM) set(INSTALL_DESTINATION_PATH ${DATA_INSTALL_DIR}/${PROJECT_NAME}-${INSTALLER_PLATFORM}/cmake) else() - set(INSTALL_DESTINATION_PATH ${DATA_INSTALL_DIR}/${PROJECT_NAME}/cmake${MSVCARCH_DIR_EXTENSION_EXT}) + set(INSTALL_DESTINATION_PATH ${LIB_INSTALL_DIR}/cmake/${PROJECT_NAME}${MSVCARCH_DIR_EXTENSION_EXT}) endif() install(EXPORT ${PROJECT_NAME}-targets