Skip to content

Commit

Permalink
Install config files in correct location (#51)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

* Updated Windows packaging cmake template with new config directory.
  • Loading branch information
hansfn authored and richiware committed Dec 19, 2019
1 parent 4fc79bf commit 86e36e8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions cmake/packaging/windows/fastcdr-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions src/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 86e36e8

Please sign in to comment.