From 0b50834f8144a457287f3b0c7869dcc630d6a033 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Thu, 2 May 2024 23:30:09 +0200 Subject: [PATCH] Fix 2955ff3: CMake atomic check fails due to chosen compiler --- cmake/3rdparty/llvm/CheckAtomic.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmake/3rdparty/llvm/CheckAtomic.cmake b/cmake/3rdparty/llvm/CheckAtomic.cmake index 2dc895d75b..86ab2ab136 100644 --- a/cmake/3rdparty/llvm/CheckAtomic.cmake +++ b/cmake/3rdparty/llvm/CheckAtomic.cmake @@ -56,6 +56,8 @@ else() check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB) # If not, check if the library exists, and atomics work with it. if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB) + # check_library_exists requires the C-compiler as the atomic functions are built-in declared. + enable_language(C) check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC) if(HAVE_LIBATOMIC) list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") @@ -77,6 +79,8 @@ else() check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB) # If not, check if the library exists, and atomics work with it. if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB) + # check_library_exists requires the C-compiler as the atomic functions are built-in declared. + enable_language(C) check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64) if(HAVE_CXX_LIBATOMICS64) list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")