From d5fb2b29d58efa683ed080c3790712ea7af8eeb6 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 16 Jan 2025 15:21:23 +0100 Subject: [PATCH] cmake: pre-fill `HAVE_STDATOMIC_H`, `HAVE_ATOMIC` for mingw-w64 `stdatomic.h` and `_Atomic` were first available in gcc 4.9.0 and llvm/clang 3.6. Set detection values accordingly and save these two detections on configure runs. Closes #16036 --- CMake/win32-cache.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMake/win32-cache.cmake b/CMake/win32-cache.cmake index cb55b74774..25323fddfc 100644 --- a/CMake/win32-cache.cmake +++ b/CMake/win32-cache.cmake @@ -45,6 +45,14 @@ if(MINGW) set(HAVE_UTIME_H 1) # wrapper to sys/utime.h set(HAVE_DIRENT_H 1) set(HAVE_OPENDIR 1) + if((CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9) OR + (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.6)) + set(HAVE_STDATOMIC_H 1) + set(HAVE_ATOMIC 1) + else() + set(HAVE_STDATOMIC_H 0) + set(HAVE_ATOMIC 0) + endif() else() set(HAVE_LIBGEN_H 0) set(HAVE_FTRUNCATE 0)