Skip to content

Commit e3554bd

Browse files
Merge branch 'kilted' into feature/add-ros-ci
2 parents 6d896f4 + 8067d4b commit e3554bd

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

CMakeLists.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,14 @@ if(NOT RCUTILS_NO_FILESYSTEM)
148148
target_link_libraries(${PROJECT_NAME} ${CMAKE_DL_LIBS})
149149
endif()
150150

151+
check_library_exists(atomic __atomic_load_8 "" HAVE_LIBATOMICS)
152+
153+
if(HAVE_LIBATOMICS AND NOT WIN32)
154+
# Exporting link flag since it won't pass ament_export_libraries() existence check
155+
ament_export_link_flags("-latomic")
156+
target_link_libraries(${PROJECT_NAME} atomic)
157+
endif()
158+
151159
# Needed if pthread is used for thread local storage.
152160
if(IOS AND IOS_SDK_VERSION LESS 10.0)
153161
ament_export_libraries(pthread)
@@ -175,13 +183,6 @@ if(BUILD_TESTING)
175183

176184
find_package(launch_testing_ament_cmake REQUIRED)
177185

178-
check_library_exists(atomic __atomic_load_8 "" HAVE_LIBATOMICS)
179-
180-
if(HAVE_LIBATOMICS AND NOT WIN32)
181-
# Exporting link flag since it won't pass ament_export_libraries() existance check
182-
ament_export_link_flags("-latomic")
183-
endif()
184-
185186
if(ament_cmake_cppcheck_FOUND)
186187
ament_cppcheck(
187188
TESTNAME "cppcheck_logging_macros"

0 commit comments

Comments
 (0)