diff --git a/CMakeLists.txt b/CMakeLists.txt index 0483a720fc..f42fd21eb5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -132,6 +132,10 @@ if (CXX_CLANG_CL) endif() endif() +if (MSVC AND NOT CXX_CLANG) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") +endif() + # Set bundled sdl2/qt as dependent options. # On Linux system SDL2 is likely to be lacking HIDAPI support which have drawbacks but is needed for SDL motion cmake_dependent_option(ENABLE_SDL2 "Enable the SDL2 frontend" ON "NOT ANDROID" OFF) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d8d9e10c9f..13b443e345 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -25,7 +25,7 @@ if (MSVC AND NOT CXX_CLANG) set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE STRING "" FORCE) # Silence "deprecation" warnings - add_compile_definitions(_CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_DEPRECATE _SCL_SECURE_NO_WARNINGS) + add_compile_definitions(_CRT_SECURE_NO_WARNINGS) # Avoid windows.h junk add_compile_definitions(NOMINMAX) @@ -38,7 +38,6 @@ if (MSVC AND NOT CXX_CLANG) # /W4 - Level 4 warnings # /MP - Multi-threaded compilation - # /Zm - Specifies the precompiled header memory allocation limit # /Zo - Enhanced debug info for optimized builds # /permissive- - Enables stricter C++ standards conformance checks # /EHsc - C++-only exception handling semantics @@ -51,7 +50,6 @@ if (MSVC AND NOT CXX_CLANG) # /GT - Supports fiber safety for data allocated using static thread-local storage add_compile_options( /MP - /Zm200 /Zo /permissive- /EHsc @@ -62,7 +60,13 @@ if (MSVC AND NOT CXX_CLANG) /Zc:inline /Zc:preprocessor /Zc:throwingNew + /Zc:__cplusplus + /Zc:lambda + /Zc:enumTypes + /Zc:ternary + /bigobj # Increase number of sections in .obj files /GT + /W4 # External headers diagnostics /external:anglebrackets # Treats all headers included by #include
, where the header file is enclosed in angle brackets (< >), as external headers @@ -92,14 +96,6 @@ if (MSVC AND NOT CXX_CLANG) /wd4702 # unreachable code (when used with LTO) ) - if (NOT CXX_CLANG) - add_compile_options( - # Warnings - /W4 - /WX- - ) - endif() - if (ARCHITECTURE_x86_64) add_compile_options(/QIntel-jcc-erratum) endif()