mirror of
https://github.com/reactos/reactos.git
synced 2025-04-26 16:40:27 +00:00
[CMAKE] Turn all warnings into errors on MSVC x86
This commit is contained in:
parent
41bc57ddf0
commit
cb9b538725
1 changed files with 20 additions and 2 deletions
|
@ -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
|
# FIXME: Temporarily disable C4018 until we fix more of the others. CORE-10113
|
||||||
add_compile_options(/wd4018)
|
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:
|
# The following warnings are treated as errors:
|
||||||
# - C4013: implicit function declaration
|
# - C4013: implicit function declaration
|
||||||
# - C4020: too many actual parameters
|
# - C4020: too many actual parameters
|
||||||
|
@ -119,6 +135,8 @@ if(MSVC_IDE OR CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
add_compile_options(/we4101 /we4189)
|
add_compile_options(/we4101 /we4189)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
# Enable warnings above the default level, but don't treat them as errors:
|
# Enable warnings above the default level, but don't treat them as errors:
|
||||||
# - C4115: named type definition in parentheses
|
# - C4115: named type definition in parentheses
|
||||||
add_compile_options(/w14115)
|
add_compile_options(/w14115)
|
||||||
|
@ -194,8 +212,8 @@ if (NOT MSVC_IDE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(_VS_ANALYZE_)
|
if(_VS_ANALYZE_)
|
||||||
message("VS static analysis enabled!")
|
message("-- VS static analysis enabled!")
|
||||||
add_compile_options(/analyze)
|
add_compile_options(/analyze:WX-)
|
||||||
elseif(_PREFAST_)
|
elseif(_PREFAST_)
|
||||||
message("PREFAST enabled!")
|
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}"
|
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}"
|
||||||
|
|
Loading…
Reference in a new issue