From 4748f25e575114350088d89693c71b0e562b07b0 Mon Sep 17 00:00:00 2001 From: Matthew Parkinson Date: Thu, 17 Jan 2019 18:23:06 +0000 Subject: [PATCH] Removing warnings from Windows Ninja configuration Windows Ninja build was complaining about /W4 and /W3 being specified, and C++ latest and C++ 17. This fixs those complaints. --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d39ff29..b2c6ed2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,13 @@ macro(linklibs project) endmacro() if(MSVC) - add_compile_options(/WX /W4 /wd4127 /wd4324 /wd4201 /std:c++latest) + # Force to always compile with W4 + if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]") + string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") + endif() + add_compile_options(/WX /wd4127 /wd4324 /wd4201) set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi") set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG") else()