diff --git a/cmake/re-config.cmake b/cmake/re-config.cmake index 6c106f2e5..0b13e2c57 100644 --- a/cmake/re-config.cmake +++ b/cmake/re-config.cmake @@ -2,7 +2,7 @@ include(CheckIncludeFile) include(CheckFunctionExists) include(CheckSymbolExists) include(CheckTypeSize) -include(CheckCSourceCompiles) +include(CheckCXXSourceCompiles) option(USE_MBEDTLS "Enable MbedTLS" OFF) @@ -266,21 +266,20 @@ endif() # Testing Atomic # -if(NOT WIN32) - set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -std=c11) -endif() +enable_language(CXX) set(ATOMIC_TEST_CODE " - #include - #include - int main() { - atomic_int_least64_t x; - atomic_store(&x, 1); - x--; - return atomic_load(&x); - }") - -check_c_source_compiles("${ATOMIC_TEST_CODE}" atomic_test) + #include + #include + std::atomic n8 (0); // riscv64 + std::atomic n64 (0); // armel, mipsel, powerpc + int main() { + ++n8; + ++n64; + return 0; + }") + +check_cxx_source_compiles("${ATOMIC_TEST_CODE}" atomic_test) if(NOT atomic_test) set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} atomic)