]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: enable `-pedantic-errors` for clang when `CURL_WERROR=ON`
authorViktor Szakats <commit@vsz.me>
Thu, 4 Apr 2024 21:22:37 +0000 (21:22 +0000)
committerViktor Szakats <commit@vsz.me>
Fri, 5 Apr 2024 13:05:36 +0000 (13:05 +0000)
clang doesn't have the issues of GCC and old CMake versions.

Note: This introduces asymmetry with autotools, which only enables
this for GCC.

Reviewed-by: Daniel Stenberg
Closes #13286

CMake/PickyWarnings.cmake

index 3510d77a73162cab167bad54125384f39eaf1556..d1183fe392a4b80328bf9b79aa99412192534146 100644 (file)
@@ -26,9 +26,10 @@ include(CheckCCompilerFlag)
 unset(WPICKY)
 
 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
+   ((CMAKE_COMPILER_IS_GNUCC AND
+     NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0 AND
+     NOT CMAKE_VERSION VERSION_LESS 3.23.0) OR  # check_symbol_exists() incompatible with GCC -pedantic-errors in earlier CMake versions
+   CMAKE_C_COMPILER_ID MATCHES "Clang"))
   set(WPICKY "${WPICKY} -pedantic-errors")
 endif()