From: Viktor Szakats Date: Thu, 24 Apr 2025 23:45:23 +0000 (+0200) Subject: cmake: stop deleting `-W` from `CMAKE_C_FLAGS` (MSVC) X-Git-Tag: curl-8_14_0~214 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1e9b48c010625d4635412612295460ecc3405235;p=thirdparty%2Fcurl.git cmake: stop deleting `-W` from `CMAKE_C_FLAGS` (MSVC) 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` 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 --- diff --git a/CMake/PickyWarnings.cmake b/CMake/PickyWarnings.cmake index 2785c7d24b..2ab9dc3517 100644 --- a/CMake/PickyWarnings.cmake +++ b/CMake/PickyWarnings.cmake @@ -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()