summaryrefslogtreecommitdiffhomepage
path: root/cmake
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-08-29 15:52:06 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-08-29 15:54:00 +0200
commitf34009428384f4244ae79a9e300fd8a35daa2175 (patch)
tree07a70f709ac0b6af0fe85a59149fc7d43e73e458 /cmake
parentc2e6cb1a8594aeb6f3491727268822fc83341c54 (diff)
cmake/msvc: only add -Werror= when building opentrack
Diffstat (limited to 'cmake')
-rw-r--r--cmake/msvc.cmake46
1 files changed, 26 insertions, 20 deletions
diff --git a/cmake/msvc.cmake b/cmake/msvc.cmake
index 0223f6f8..bd91f00a 100644
--- a/cmake/msvc.cmake
+++ b/cmake/msvc.cmake
@@ -14,22 +14,26 @@ 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")
-#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_ "")
-set(warns 4263 4264 4266 4928)
-set(warns-noerr 4265)
+if(CMAKE_PROJECT_NAME STREQUAL "opentrack")
+ #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
-foreach(i ${warns})
- set(warns_ "${warns_} /w1${i} /we${i}")
-endforeach()
+ set(warns 4263 4264 4266 4928)
+ set(warns-noerr 4265)
-foreach(i ${warns-noerr})
- set(warns_ "${warns_} /w1${i}")
-endforeach()
+ foreach(i ${warns})
+ set(warns_ "${warns_} /w1${i} /we${i}")
+ endforeach()
+
+ foreach(i ${warns-noerr})
+ set(warns_ "${warns_} /w1${i}")
+ endforeach()
+endif()
set(silly "${warns_} -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -D_ITERATOR_DEBUG_LEVEL=0 -D_HAS_ITERATOR_DEBUGGING=0 -D_SECURE_SCL=0")
@@ -85,13 +89,15 @@ 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()
+ if(CMAKE_PROJECT_NAME STREQUAL "opentrack")
+ set(warn-flag-found FALSE)
+ foreach (i CMAKE_CXX_FLAGS CMAKE_C_FLAGS)
+ string(REGEX MATCH "((^| )/[W][0-9]( |\$))" ret "${${i}}")
+ if(ret STREQUAL "")
+ set(${i} "-W3 ${${i}}" CACHE STRING "" FORCE)
+ endif()
+ endforeach()
+ endif()
set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} -nologo")
endif()