From 083c2e342a49ed2b3a9ee715ebc1107a0f813c7f Mon Sep 17 00:00:00 2001 From: Eduardo Ponz Segrelles Date: Mon, 21 Dec 2020 15:39:19 +0100 Subject: [PATCH] Install FindAtomic.cmake (#1652) * Refs #9825: Find atomic in fastrtps-config.cmake Signed-off-by: EduPonz * Refs #9825: Install FindAtomic.cmake Signed-off-by: EduPonz * Refs #9825: Private link with atomic Signed-off-by: EduPonz * Refs #9825: Hint to find atomic Signed-off-by: EduPonz * Refs #9825: Atomic required Signed-off-by: EduPonz * Refs #9825: Add modules to CMAKE_CURRENT_LIST_DIR Signed-off-by: EduPonz * Refs #9825: Locally modify CMAKE_CURRENT_LIST_DIR Signed-off-by: EduPonz --- cmake/packaging/Config.cmake.in | 11 +++++++++++ src/cpp/CMakeLists.txt | 9 +++++++++ 2 files changed, 20 insertions(+) diff --git a/cmake/packaging/Config.cmake.in b/cmake/packaging/Config.cmake.in index 2c2c1b282ea..5d946d8f50f 100644 --- a/cmake/packaging/Config.cmake.in +++ b/cmake/packaging/Config.cmake.in @@ -25,6 +25,17 @@ set_and_check(@PROJECT_NAME@_LIB_DIR "@PACKAGE_LIB_INSTALL_DIR@") find_package(fastcdr REQUIRED) find_package(foonathan_memory REQUIRED) find_package(TinyXML2 QUIET) + +# Find atomic using Fast DDS FindAtomic.cmake +# 1. Save incoming CMAKE_MODULE_PATH +# 2. Extend CMAKE_MODULE_PATH so atomic can be found +# 3. Reset CMAKE_MODULE_PATH to incoming value +# 4. Unset temp variable +set(TEMP_CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}") +set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_LIST_DIR}/modules") +find_package(Atomic MODULE REQUIRED) +set(CMAKE_MODULE_PATH "${TEMP_CMAKE_MODULE_PATH}") +unset(TEMP_CMAKE_MODULE_PATH) @FASTRTPS_PACKAGE_OPT_DEPS@ include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake) diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index 25340ad199a..8ad83d650fd 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -405,6 +405,9 @@ elseif(NOT EPROSIMA_INSTALLER) ${THIRDPARTY_BOOST_INCLUDE_DIR} ) + # PRIVACY is PUBLIC by default + set(PRIVACY "PUBLIC") + # Made linked libraries PRIVATE to prevent local directories in Windows installer. if(EPROSIMA_INSTALLER_MINION) set(PRIVACY "PRIVATE") @@ -630,6 +633,12 @@ elseif(NOT EPROSIMA_INSTALLER) COMPONENT cmake ) + # Install FindAtomic.cmake in case external application want to make use of it + install(FILES ${PROJECT_SOURCE_DIR}/cmake/modules/FindAtomic.cmake + DESTINATION ${INSTALL_DESTINATION_PATH}/modules + COMPONENT cmake + ) + if(MSVCARCH_EXTENSION) string(TOUPPER "${MSVC_ARCH}" MSVC_ARCH_UPPER) set(CPACK_COMPONENT_LIBRARIES_${MSVC_ARCH_UPPER}_DISPLAY_NAME "${MSVC_ARCH}" PARENT_SCOPE)