# 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
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)
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}"