Skip to content

Commit 1879f2c

Browse files
author
Tomoya Fujita
authored
Export -latomic even if BUILD_TESTING is disabled. (ros2#516)
Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com> Signed-off-by: Timo Röhling <roehling@debian.org>
1 parent f934aa6 commit 1879f2c

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

‎CMakeLists.txt‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@ endif()
9696

9797
target_link_libraries(${PROJECT_NAME} ${CMAKE_DL_LIBS})
9898

99+
check_library_exists(atomic __atomic_load_8 "" HAVE_LIBATOMICS)
100+
101+
if(HAVE_LIBATOMICS AND NOT WIN32)
102+
# Exporting link flag since it won't pass ament_export_libraries() existence check
103+
ament_export_link_flags("-latomic")
104+
target_link_libraries(${PROJECT_NAME} atomic)
105+
endif()
106+
99107
# Needed if pthread is used for thread local storage.
100108
if(IOS AND IOS_SDK_VERSION LESS 10.0)
101109
ament_export_libraries(pthread)
@@ -122,13 +130,6 @@ if(BUILD_TESTING)
122130

123131
find_package(launch_testing_ament_cmake REQUIRED)
124132

125-
check_library_exists(atomic __atomic_load_8 "" HAVE_LIBATOMICS)
126-
127-
if(HAVE_LIBATOMICS AND NOT WIN32)
128-
# Exporting link flag since it won't pass ament_export_libraries() existance check
129-
ament_export_link_flags("-latomic")
130-
endif()
131-
132133
find_package(mimick_vendor REQUIRED)
133134

134135
find_package(osrf_testing_tools_cpp REQUIRED)

0 commit comments

Comments
 (0)