-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Description
# Check if we need to link libatomic (required on some platforms for atomic ops)
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("
#include <atomic>
int main() {
std::atomic<int> x;
x.exchange(1);
return 0;
}
" HAVE_CXX_ATOMICS_WITHOUT_LIB)
if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
# Try with -latomic
set(CMAKE_REQUIRED_LIBRARIES atomic)
check_cxx_source_compiles("
#include <atomic>
int main() {
std::atomic<int> x;
x.exchange(1);
return 0;
}
" HAVE_CXX_ATOMICS_WITH_LIB)
unset(CMAKE_REQUIRED_LIBRARIES)
if(HAVE_CXX_ATOMICS_WITH_LIB)
target_link_libraries(cbsdk_static PUBLIC atomic)
endif()
endif()
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels