]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: pre-fill `HAVE_STDATOMIC_H`, `HAVE_ATOMIC` for mingw-w64
authorViktor Szakats <commit@vsz.me>
Thu, 16 Jan 2025 14:21:23 +0000 (15:21 +0100)
committerViktor Szakats <commit@vsz.me>
Fri, 17 Jan 2025 14:11:22 +0000 (15:11 +0100)
`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

index cb55b74774d453c7452225f5489aa8174c3f1e63..25323fddfcd8f8f02a0bc71c0df57bef880cdbed 100644 (file)
@@ -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)