Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: set MSVC warning level to 4 #1711

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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).
1 change: 1 addition & 0 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions tests/server/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)