From 6dcb26d21ed116016f0f3ee7630f532a70a66b79 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sat, 19 Mar 2022 18:19:44 -0400 Subject: Fix test for whether atomic library is needed Some platforms need it for atomic but not for atomic. --- CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index d58f76c9..33ff69aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -154,6 +154,7 @@ if(WIN32 AND NOT SKIP_OS_SECURE_RANDOM) endif() include(CheckCXXSourceCompiles) +set(ATOMIC_LIBRARY) function(check_atomic) foreach(I 0 1) if(I) @@ -162,8 +163,8 @@ function(check_atomic) check_cxx_source_compiles( "#include int main() { - static std::atomic a{0}; - a = a.fetch_add(1); + static std::atomic a{0}; + a = a.fetch_add(1LL); return 0; }" ATOMIC_WORKED${I}) @@ -172,7 +173,7 @@ int main() { endif() endforeach() if(ATOMIC_WORKED1) - list(APPEND CMAKE_REQUIRED_LIBRARIES atomic) + set(ATOMIC_WORKED1 atomic PARENT_SCOPE) endif() endfunction() check_atomic() -- cgit v1.2.3-54-g00ecf