Skip to content

Commit 9486cb5

Browse files
committed
Make: Avoid -latomic on AppleClang
1 parent 35baa71 commit 9486cb5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

scripts/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ foreach (STD IN LISTS CXX_STANDARDS)
5454
add_test(NAME ${TGT} COMMAND ${TGT})
5555
set_target_properties_for_fork_union_script(${TGT})
5656

57-
# Link against libatomic for older GCC versions that might need it
58-
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
57+
# Link against `libatomic` for older GCC versions that might need it
58+
# Note: AppleClang doesn't need `libatomic` as atomic operations are built-in
59+
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR
60+
(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"))
5961
target_link_libraries(${TGT} PRIVATE -latomic)
6062
endif ()
6163

0 commit comments

Comments
 (0)