Author: rinrab
Date: Fri Jul  5 14:59:48 2024
New Revision: 1918937

URL: http://svn.apache.org/viewvc?rev=1918937&view=rev
Log:
On the 'cmake' branch: Setup MSVC warnings.

The following changing in compile options have been made:

- Add `/W4` option to change the warning level to 4.
- Add `/wd****` flags for disabling these warnings.
- Add `/we****` flags to treat the critical warnings as error.

This list taken from VC.Net generator.

* CMakeLists.txt:
  (policies): Enable CMP0092 policy for later changing the warning level.
  (MSVC compile options): Setup the options as explained above.

Modified:
    subversion/branches/cmake/CMakeLists.txt

Modified: subversion/branches/cmake/CMakeLists.txt
URL: 
http://svn.apache.org/viewvc/subversion/branches/cmake/CMakeLists.txt?rev=1918937&r1=1918936&r2=1918937&view=diff
==============================================================================
--- subversion/branches/cmake/CMakeLists.txt (original)
+++ subversion/branches/cmake/CMakeLists.txt Fri Jul  5 14:59:48 2024
@@ -21,6 +21,11 @@
 
 cmake_minimum_required(VERSION 3.12)
 
+# CMP0092: MSVC warning flags are not in CMAKE_<LANG>_FLAGS by default.
+if(POLICY CMP0092)
+  cmake_policy(SET CMP0092 NEW)
+endif()
+
 project("Subversion")
 
 configure_file(
@@ -185,6 +190,41 @@ if (WIN32)
   )
 endif()
 
+if (MSVC)
+  # Setup warning level
+  add_compile_options(/W4)
+
+  # Disable warning
+  add_compile_options(/wd4100)
+  add_compile_options(/wd4127)
+  add_compile_options(/wd4206)
+  add_compile_options(/wd4512)
+  add_compile_options(/wd4701)
+  add_compile_options(/wd4706)
+  add_compile_options(/wd4800)
+
+  # Treat some criticial warnings as error
+  add_compile_options(/we4002)
+  add_compile_options(/we4003)
+  add_compile_options(/we4013)
+  add_compile_options(/we4020)
+  add_compile_options(/we4022)
+  add_compile_options(/we4024)
+  add_compile_options(/we4028)
+  add_compile_options(/we4029)
+  add_compile_options(/we4030)
+  add_compile_options(/we4031)
+  add_compile_options(/we4033)
+  add_compile_options(/we4047)
+  add_compile_options(/we4089)
+  add_compile_options(/we4113)
+  add_compile_options(/we4133)
+  add_compile_options(/we4204)
+  add_compile_options(/we4700)
+  add_compile_options(/we4715)
+  add_compile_options(/we4789)
+endif()
+
 if (NOT EXISTS "${CMAKE_SOURCE_DIR}/build/cmake/targets.cmake")
   message(FATAL_ERROR
     "The 'build/cmake/targets.cmake' file does NOT exist. "


Reply via email to