]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: fix `CURL_WERROR=ON` for old CMake and use it in GHA/linux-old
authorViktor Szakats <commit@vsz.me>
Thu, 4 Apr 2024 10:45:01 +0000 (10:45 +0000)
committerViktor Szakats <commit@vsz.me>
Fri, 5 Apr 2024 13:05:19 +0000 (13:05 +0000)
- cmake: fix `-pedantic-errors` for old CMake with `CURL_WERROR=ON` set.

  `-pedantic-errors` option throws a warning with GCC (all versions) and
  makes `check_symbol_exists()` fail in CMake versions older than
  v3.23.0 (2022-03-29), when CMake introduced a workaround:

  https://gitlab.kitware.com/cmake/cmake/-/issues/13208
  https://gitlab.kitware.com/cmake/cmake/-/commit/eeb45401163d831b8c841ef6eba81466b4067b68
  https://gitlab.kitware.com/cmake/cmake/-/commit/1ab7c3cd28b27ca162c4559e1026e5cad1898ade

  Follow-up to 3829759bd042c03225ae862062560f568ba1a231 #12489

- set `CURL_WERROR=ON` for the `linux-old` job in CI.

Closes #13282

.github/workflows/linux-old.yml
CMake/PickyWarnings.cmake

index 73174e80f9bbdb6ee1ac01863dc27b9e5b8c6ebd..c38e359f50bd229f3be770f63171a9a2ff4f52f4 100644 (file)
@@ -83,7 +83,7 @@ jobs:
         run: |
           mkdir build
           cd build
-          cmake -DCMAKE_UNITY_BUILD=ON -DBUILD_SHARED_LIBS=ON -DENABLE_ARES=ON -DCURL_ZSTD=ON -DCURL_USE_LIBSSH=ON -DCURL_USE_GSSAPI=ON ..
+          cmake -DCMAKE_UNITY_BUILD=ON -DCURL_WERROR=ON -DBUILD_SHARED_LIBS=ON -DENABLE_ARES=ON -DCURL_ZSTD=ON -DCURL_USE_LIBSSH=ON -DCURL_USE_GSSAPI=ON ..
 
       - name: 'build'
         run: make -C build
index d82bbb1d6a6a97530cb4a9108fc7d28fd50e99b2..3510d77a73162cab167bad54125384f39eaf1556 100644 (file)
@@ -25,7 +25,10 @@ include(CheckCCompilerFlag)
 
 unset(WPICKY)
 
-if(CURL_WERROR AND CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0)
+if(CURL_WERROR AND
+   CMAKE_COMPILER_IS_GNUCC AND
+   NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0 AND
+   NOT CMAKE_VERSION VERSION_LESS 3.23.0)  # check_symbol_exists() incompatible with GCC -pedantic-errors in earlier CMake versions
   set(WPICKY "${WPICKY} -pedantic-errors")
 endif()