]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: stop deleting `-W<n>` from `CMAKE_C_FLAGS` (MSVC)
authorViktor Szakats <commit@vsz.me>
Thu, 24 Apr 2025 23:45:23 +0000 (01:45 +0200)
committerViktor Szakats <commit@vsz.me>
Fri, 25 Apr 2025 09:42:24 +0000 (11:42 +0200)
1. `CMAKE_C_FLAGS` may apply to other projects, and deleting/altering it
   may be unexpected.

2. We pass `-W4`/`-Wall` internally now, which do override custom
   `-W<n>` options in all supported MSVC versions.
   (as tested with Visual Studio generators)
   Ref: https://ci.appveyor.com/project/curlorg/curl/builds/51945416

Follow-up to e86542038dda88dadf8959584e803895f979310c #17047
Ref: 866e02935deb28373130116dac578d84e057a03e #1711

Closes #17179

CMake/PickyWarnings.cmake

index 2785c7d24bfb18861a8e6959964c712e75d8ff14..2ab9dc3517926cdfba3be99de2b34a3a981cd070 100644 (file)
@@ -52,9 +52,7 @@ if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
 endif()
 
 if(MSVC)
-  # Use the highest warning level for Visual Studio.
-  string(REGEX REPLACE "[/-]W[0-4]" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
-  list(APPEND _picky "-W4")
+  list(APPEND _picky "-W4")  # Use the highest warning level for Visual Studio.
 elseif(BORLAND)
   list(APPEND _picky "-w-")  # Disable warnings on Borland to avoid changing 3rd party code.
 endif()