Skip to content

Commit 551a9fb

Browse files
Don't link atomic on windows
1 parent 2bb6519 commit 551a9fb

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

CMakeLists.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,14 @@ if(BUILD_TESTING)
8282
ament_add_gmock(realtime_buffer_tests test/realtime_buffer_tests.cpp)
8383
target_link_libraries(realtime_buffer_tests realtime_tools)
8484

85+
ament_add_gmock(lock_free_queue_tests test/lock_free_queue_tests.cpp)
8586
if(WIN32)
86-
set(HAVE_CXX_ATOMICS64_WITHOUT_LIB True)
87-
set(HAVE_CXX_ATOMICS_WITHOUT_LIB True)
88-
set(FOUND_LIBATOMIC TRUE)
87+
# atomic is not found on Windows, but also not needed
88+
target_link_libraries(lock_free_queue_tests realtime_tools Boost::boost)
89+
else()
90+
# without adding atomic, clang throws a linker error
91+
target_link_libraries(lock_free_queue_tests realtime_tools atomic Boost::boost)
8992
endif()
90-
ament_add_gmock(lock_free_queue_tests test/lock_free_queue_tests.cpp)
91-
target_link_libraries(lock_free_queue_tests realtime_tools atomic Boost::boost)
9293

9394
ament_add_gmock(realtime_clock_tests test/realtime_clock_tests.cpp)
9495
target_link_libraries(realtime_clock_tests realtime_tools)

0 commit comments

Comments
 (0)