summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-08-28 10:32:58 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-08-28 10:40:14 +0200
commite096b49be2d09fe2c8b84dd2dac942e3dcda7036 (patch)
tree58350d2379c48e3d9e939bb0cb2c85908a5c6278
parentc52b76dbd67a65db4ee342bd57bec59ba573d7a3 (diff)
cmake/msvc: add warning flag logic to toolchain def
-rw-r--r--cmake/msvc.cmake30
1 files changed, 28 insertions, 2 deletions
diff --git a/cmake/msvc.cmake b/cmake/msvc.cmake
index 16c14d8f..0223f6f8 100644
--- a/cmake/msvc.cmake
+++ b/cmake/msvc.cmake
@@ -12,9 +12,26 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# oldest CPU supported here is Northwood-based Pentium 4. -sh 20150811
-set(cc "/Ox /arch:SSE2 /EHscr /fp:fast /GS- /GF /GL /GR- /Gy /MT /Y- /Zi /W1")
+set(cc "/Ox /arch:SSE2 /EHscr /fp:fast /GS- /GF /GL /GR- /Gy /MT /Y- /Zi")
-set(silly "-DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -D_ITERATOR_DEBUG_LEVEL=0 -D_HAS_ITERATOR_DEBUGGING=0 -D_SECURE_SCL=0")
+#C4263 - member function does not override any base class virtual member function
+#C4264 - no override available for virtual member function from base class, function is hidden
+#C4265 - class has virtual functions, but destructor is not virtual
+#C4266 - no override available for virtual member function from base type, function is hidden
+#C4928 - illegal copy-initialization, more than one user-defined conversion has been implicitly applied
+
+set(warns 4263 4264 4266 4928)
+set(warns-noerr 4265)
+
+foreach(i ${warns})
+ set(warns_ "${warns_} /w1${i} /we${i}")
+endforeach()
+
+foreach(i ${warns-noerr})
+ set(warns_ "${warns_} /w1${i}")
+endforeach()
+
+set(silly "${warns_} -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -D_ITERATOR_DEBUG_LEVEL=0 -D_HAS_ITERATOR_DEBUGGING=0 -D_SECURE_SCL=0")
set(_CFLAGS "${silly}")
set(_CXXFLAGS "${silly}")
@@ -68,4 +85,13 @@ if((CMAKE_GENERATOR STREQUAL "NMake Makefiles") OR (CMAKE_GENERATOR STREQUAL "NM
message("\n--")
message(FATAL_ERROR "cannot continue.")
endif()
+ set(warn-flag-found FALSE)
+ foreach (i CMAKE_CXX_FLAGS CMAKE_C_FLAGS)
+ string(REGEX MATCH "((^| )/[wW][^ ]*)" ret "${${i}}")
+ if(ret STREQUAL "")
+ set(${i} "-W3 ${${i}}" CACHE STRING "" FORCE)
+ endif()
+ endforeach()
+
+ set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} -nologo")
endif()