Index: cmake/Modules/CheckLibcxxAtomic.cmake =================================================================== --- cmake/Modules/CheckLibcxxAtomic.cmake +++ cmake/Modules/CheckLibcxxAtomic.cmake @@ -1,4 +1,4 @@ -INCLUDE(CheckCXXSourceCompiles) +INCLUDE(CheckCSourceCompiles) # Sometimes linking against libatomic is required for atomic ops, if # the platform doesn't support lock-free atomics. @@ -9,17 +9,16 @@ function(check_cxx_atomics varname) set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) - set(CMAKE_REQUIRED_FLAGS "-std=c++11 -nostdinc++ -isystem ${LIBCXX_SOURCE_DIR}/include") + set(CMAKE_REQUIRED_FLAGS "-std=c11") if (${LIBCXX_GCC_TOOLCHAIN}) set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} --gcc-toolchain=${LIBCXX_GCC_TOOLCHAIN}") endif() - check_cxx_source_compiles(" -#include -#include -std::atomic x; -std::atomic y; + check_c_source_compiles(" +#include +atomic_uintptr_t x; +atomic_uintmax_t y; int main() { - return x + y; + return atomic_load(&x) + atomic_load(&y); } " ${varname}) set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})