diff --git a/CMakeLists.txt b/CMakeLists.txt index f21d89e8f..171941128 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1161,6 +1161,11 @@ endif(WIN32) if(MSVC) add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE) + if(CMAKE_C_FLAGS MATCHES "/W[0-4]") + string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") + else(CMAKE_C_FLAGS MATCHES "/W[0-4]") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4") + endif(CMAKE_C_FLAGS MATCHES "/W[0-4]") endif(MSVC) # Ugly (but functional) way to include "Makefile.inc" by transforming it (= regenerate it). diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 667754480..d6c996189 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -12,6 +12,7 @@ list(APPEND HHEADERS if(MSVC) list(APPEND CSOURCES libcurl.rc) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4127") endif() # SET(CSOURCES diff --git a/tests/server/CMakeLists.txt b/tests/server/CMakeLists.txt index e456a94df..cfc1434cd 100644 --- a/tests/server/CMakeLists.txt +++ b/tests/server/CMakeLists.txt @@ -1,5 +1,9 @@ set(TARGET_LABEL_PREFIX "Test server ") +if(MSVC) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4127 /wd4306") +endif() + function(SETUP_EXECUTABLE TEST_NAME) # ARGN are the files in the test add_executable( ${TEST_NAME} ${ARGN} ) string(TOUPPER ${TEST_NAME} UPPER_TEST_NAME)