]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: replace CMAKE_COMPILER_IS_GNUCC with CMAKE_C_COMPILER_ID
authorPeter Kokot <peterkokot@gmail.com>
Sat, 22 Mar 2025 15:02:28 +0000 (16:02 +0100)
committerViktor Szakats <commit@vsz.me>
Sat, 22 Mar 2025 23:06:25 +0000 (00:06 +0100)
Variable `CMAKE_COMPILER_IS_GNUCC` is deprecated and
`CMAKE_C_COMPILER_ID` should be used instead.

Closes #16797

CMake/CurlSymbolHiding.cmake
CMake/PickyWarnings.cmake
CMake/win32-cache.cmake
CMakeLists.txt
tests/CMakeLists.txt

index b962cf0e6ca1568a0b35914ea7b0e21e44784e99..48ef193b9a67fa63a22aa2a98e50c17db9242dc7 100644 (file)
@@ -42,7 +42,7 @@ if(CURL_HIDDEN_SYMBOLS)
     set(CURL_HIDES_PRIVATE_SYMBOLS TRUE)
     set(CURL_EXTERN_SYMBOL "__attribute__((__visibility__(\"default\")))")
     set(CURL_CFLAG_SYMBOLS_HIDE "-fvisibility=hidden")
-  elseif(CMAKE_COMPILER_IS_GNUCC)
+  elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU")
     if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
       # Note: This is considered buggy prior to 4.0 but the autotools do not care, so let us ignore that fact
       set(CURL_HIDES_PRIVATE_SYMBOLS TRUE)
index 3a17a98dc500f16f1d2f3208c2b796b86367ade4..4f04ed133023b17853c3185642fa4be06807858f 100644 (file)
@@ -26,7 +26,7 @@ include(CheckCCompilerFlag)
 set(_picky "")
 
 if(CURL_WERROR AND
-   ((CMAKE_COMPILER_IS_GNUCC AND
+   ((CMAKE_C_COMPILER_ID STREQUAL "GNU" AND
      NOT DOS AND  # Watt-32 headers use the '#include_next' GCC extension
      NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0 AND
      NOT CMAKE_VERSION VERSION_LESS 3.23.0) OR  # to avoid check_symbol_exists() conflicting with GCC -pedantic-errors
@@ -40,7 +40,7 @@ if(APPLE AND
   list(APPEND _picky "-Werror=partial-availability")  # clang 3.6  appleclang 6.3
 endif()
 
-if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
   list(APPEND _picky "-Werror-implicit-function-declaration")  # clang 1.0  gcc 2.95
 endif()
 
@@ -54,7 +54,7 @@ elseif(BORLAND)
 endif()
 
 if(PICKY_COMPILER)
-  if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
+  if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
 
     # https://clang.llvm.org/docs/DiagnosticsReference.html
     # https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
@@ -254,7 +254,7 @@ if(PICKY_COMPILER)
       endif()
     endforeach()
 
-    if(CMAKE_COMPILER_IS_GNUCC)
+    if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
       if(CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5)
         # Avoid false positives
         list(APPEND _picky "-Wno-shadow")
index 615db9e49c644798f3eacaa9743f3854d3d0afdd..ee2d9f9d3b0a856a08933239acac401f26e8aba6 100644 (file)
@@ -75,7 +75,7 @@ else()
   endif()
 endif()
 
-if((CMAKE_COMPILER_IS_GNUCC              AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9) OR
+if((CMAKE_C_COMPILER_ID STREQUAL "GNU"   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))
   # MinGW or clang-cl
   set(HAVE_STDATOMIC_H 1)
index f19467a8ccc31cf95d052f5d12935ccea622b318..fcbd3426c83da9c38828429ce504f661b898d017 100644 (file)
@@ -91,7 +91,7 @@ if(WINDOWS_STORE AND MINGW)  # mingw UWP build
   # CMake (as of v3.31.2) gets confused and applies the MSVC rc.exe command-line
   # template to windres. Reset it to the windres template via 'Modules/Platform/Windows-windres.cmake':
   set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff <DEFINES> <INCLUDES> <FLAGS> <SOURCE> <OBJECT>")
-elseif(WIN32 AND WINCE AND CMAKE_COMPILER_IS_GNUCC)  # mingw32ce build
+elseif(WIN32 AND WINCE AND CMAKE_C_COMPILER_ID STREQUAL "GNU")  # mingw32ce build
   if(NOT MINGW32CE_LIBRARY_DIR)
     message(FATAL_ERROR "Set MINGW32CE_LIBRARY_DIR variable to the mingw32ce platform library directory.")
   endif()
@@ -118,7 +118,7 @@ elseif(WIN32 AND WINCE AND CMAKE_COMPILER_IS_GNUCC)  # mingw32ce build
   set(CMAKE_IMPORT_LIBRARY_SUFFIX ".dll.a")
   set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "")
   set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a" ".lib")
-elseif(DOS AND CMAKE_COMPILER_IS_GNUCC)  # DJGPP
+elseif(DOS AND CMAKE_C_COMPILER_ID STREQUAL "GNU")  # DJGPP
   set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
   set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
   set(CMAKE_FIND_LIBRARY_PREFIXES "lib")
@@ -161,7 +161,7 @@ endif()
 if(AMIGA)
   string(APPEND _target_flags " AMIGA")
 endif()
-if(CMAKE_COMPILER_IS_GNUCC)
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
   string(APPEND _target_flags " GCC")
 endif()
 if(MINGW)
index b03fd53216fdb3f51828ca48b140f16490873c6b..295750c85b56cdff09e5036485f6c4c46522566a 100644 (file)
@@ -79,7 +79,7 @@ function(curl_add_pytests _targetname _test_flags)
 endfunction()
 
 # Create configurehelp.pm, used by tests needing to run the C preprocessor.
-if(MSVC OR CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
+if(MSVC OR CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
   set(CURL_CPP "\"${CMAKE_C_COMPILER}\" -E")
   if(APPLE AND CMAKE_OSX_SYSROOT)
     string(APPEND CURL_CPP " -isysroot ${CMAKE_OSX_SYSROOT}")