Remove redundant MSVC++ /W3 triggering warnings

This change looks for CMake's default setting for MSVC++, /W3 (and any
other level should that change in the future), and removes it before
adding /W4. This stops the build for MSVC++ emitting warnings about
/W4 overriding /W3 earlier on the command line.
This commit is contained in:
Billy Robert O'Neal III 2016-04-27 18:44:39 -07:00
parent fa8b2d6171
commit 60b5921735

View File

@ -33,7 +33,8 @@ include(CXXFeatureCheck)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# Turn compiler warnings up to 11 # Turn compiler warnings up to 11
add_cxx_compiler_flag(-W4) string(REGEX REPLACE "[-/]W[1-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
add_definitions(-D_CRT_SECURE_NO_WARNINGS) add_definitions(-D_CRT_SECURE_NO_WARNINGS)
# Link time optimisation # Link time optimisation