File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -148,6 +148,14 @@ if(NOT RCUTILS_NO_FILESYSTEM)
148148 target_link_libraries (${PROJECT_NAME} ${CMAKE_DL_LIBS} )
149149endif ()
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.
152160if (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"
You can’t perform that action at this time.
0 commit comments