https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cb9b5387254c613e57aad…
commit cb9b5387254c613e57aadd852e05b4dc8e64344a
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Fri Feb 21 20:07:27 2020 +0100
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Fri Jul 23 22:03:48 2021 +0200
[CMAKE] Turn all warnings into errors on MSVC x86
---
sdk/cmake/msvc.cmake | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/sdk/cmake/msvc.cmake b/sdk/cmake/msvc.cmake
index e6b533a5bb4..f32f88cf786 100644
--- a/sdk/cmake/msvc.cmake
+++ b/sdk/cmake/msvc.cmake
@@ -88,6 +88,22 @@ add_compile_options(/wd4244 /wd4290 /wd4800 /wd4200 /wd4214)
# FIXME: Temporarily disable C4018 until we fix more of the others. CORE-10113
add_compile_options(/wd4018)
+# Allow all warnings on msbuild/VS IDE
+if (MSVC_IDE)
+ set(ALLOW_WARNINGS TRUE)
+endif()
+
+# On x86 Debug builds, if it's not Clang-CL or msbuild, treat all warnings as errors
+if ((ARCH STREQUAL "i386") AND (CMAKE_BUILD_TYPE STREQUAL "Debug")
AND (NOT USE_CLANG_CL) AND (NOT MSVC_IDE))
+ set(TREAT_ALL_WARNINGS_AS_ERRORS=TRUE)
+endif()
+
+# Define ALLOW_WARNINGS=TRUE on the cmake/configure command line to bypass errors
+if (ALLOW_WARNINGS)
+ # Nothing
+elseif (TREAT_ALL_WARNINGS_AS_ERRORS)
+ add_compile_options(/WX)
+else()
# The following warnings are treated as errors:
# - C4013: implicit function declaration
# - C4020: too many actual parameters
@@ -119,6 +135,8 @@ if(MSVC_IDE OR CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_options(/we4101 /we4189)
endif()
+endif()
+
# Enable warnings above the default level, but don't treat them as errors:
# - C4115: named type definition in parentheses
add_compile_options(/w14115)
@@ -194,8 +212,8 @@ if (NOT MSVC_IDE)
endif()
if(_VS_ANALYZE_)
- message("VS static analysis enabled!")
- add_compile_options(/analyze)
+ message("-- VS static analysis enabled!")
+ add_compile_options(/analyze:WX-)
elseif(_PREFAST_)
message("PREFAST enabled!")
set(CMAKE_C_COMPILE_OBJECT "prefast <CMAKE_C_COMPILER>
${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <INCLUDES> <FLAGS> <DEFINES>
/Fo<OBJECT> -c <SOURCE>${CMAKE_END_TEMP_FILE}"