File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -25,12 +25,16 @@ message(STATUS "CMAKE_BUILD_TYPE is set to '${CMAKE_BUILD_TYPE}'")
2525
2626find_package (Threads REQUIRED)
2727
28+ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
29+ include (cmake/atomic.cmake)
30+ endif ()
31+
2832# ------ Declare library ------
2933
3034add_library (libfork_libfork INTERFACE )
3135add_library (libfork::libfork ALIAS libfork_libfork)
3236
33- target_link_libraries (libfork_libfork INTERFACE Threads::Threads)
37+ target_link_libraries (libfork_libfork INTERFACE Threads::Threads ${LIBFORK_EXTRA_LIBS} )
3438
3539set_property (TARGET libfork_libfork PROPERTY EXPORT_NAME libfork)
3640
Original file line number Diff line number Diff line change 1+ include (CheckCXXSourceCompiles)
2+ check_cxx_source_compiles("#include <atomic>
3+ int main() {
4+ std::atomic<uint8_t> w1;
5+ std::atomic<uint64_t> w8;
6+ return ++w1 + ++w8;
7+ }" NATIVE_ATOMICS_SUPPORTED)
8+
9+ if (NOT NATIVE_ATOMICS_SUPPORTED)
10+ set (LIBFORK_EXTRA_LIBS ${LIBFORK_EXTRA_LIBS} atomic)
11+ endif ()
You can’t perform that action at this time.
0 commit comments