Skip to content

Commit

Permalink
Install FindAtomic.cmake (#1652)
Browse files Browse the repository at this point in the history
* Refs #9825: Find atomic in fastrtps-config.cmake

Signed-off-by: EduPonz <[email protected]>

* Refs #9825: Install FindAtomic.cmake

Signed-off-by: EduPonz <[email protected]>

* Refs #9825: Private link with atomic

Signed-off-by: EduPonz <[email protected]>

* Refs #9825: Hint to find atomic

Signed-off-by: EduPonz <[email protected]>

* Refs #9825: Atomic required

Signed-off-by: EduPonz <[email protected]>

* Refs #9825: Add modules to CMAKE_CURRENT_LIST_DIR

Signed-off-by: EduPonz <[email protected]>

* Refs #9825: Locally modify CMAKE_CURRENT_LIST_DIR

Signed-off-by: EduPonz <[email protected]>
  • Loading branch information
EduPonz authored Dec 21, 2020
1 parent 9a1614c commit 083c2e3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmake/packaging/Config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions src/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 083c2e3

Please sign in to comment.