Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export -latomic even if BUILD_TESTING is disabled #384

Open
wants to merge 1 commit into
base: rolling
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,14 @@ endif()

target_link_libraries(${PROJECT_NAME} ${CMAKE_DL_LIBS})

check_library_exists(atomic __atomic_load_8 "" HAVE_LIBATOMICS)

if(HAVE_LIBATOMICS AND NOT WIN32)
# Exporting link flag since it won't pass ament_export_libraries() existance check
ament_export_link_flags("-latomic")
target_link_libraries(${PROJECT_NAME} atomic)
endif()

# Needed if pthread is used for thread local storage.
if(IOS AND IOS_SDK_VERSION LESS 10.0)
ament_export_libraries(pthread)
Expand All @@ -157,13 +165,6 @@ if(BUILD_TESTING)

find_package(launch_testing_ament_cmake REQUIRED)

check_library_exists(atomic __atomic_load_8 "" HAVE_LIBATOMICS)

if(HAVE_LIBATOMICS AND NOT WIN32)
# Exporting link flag since it won't pass ament_export_libraries() existance check
ament_export_link_flags("-latomic")
endif()

if(ament_cmake_cppcheck_FOUND)
ament_cppcheck(
TESTNAME "cppcheck_logging_macros"
Expand Down