summaryrefslogtreecommitdiffhomepage
path: root/cmake
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2019-05-05 12:35:36 +0200
committerStanislaw Halik <sthalik@misaki.pl>2019-05-06 03:42:18 +0200
commite4ec3180c8ba792cbf92d8fda340116f016835d1 (patch)
tree8a60b7b0b7ca5ae0938b16cc1c7c66fc07c03c0f /cmake
parentc033bacae076580d86458496d15af608e4f34042 (diff)
cmake: cleanup msvc
Diffstat (limited to 'cmake')
-rw-r--r--cmake/msvc.cmake43
-rw-r--r--cmake/opentrack-platform.cmake15
2 files changed, 27 insertions, 31 deletions
diff --git a/cmake/msvc.cmake b/cmake/msvc.cmake
index f9ef5fd5..69a8ebef 100644
--- a/cmake/msvc.cmake
+++ b/cmake/msvc.cmake
@@ -3,7 +3,7 @@
# mkdir build && cmake -DCMAKE_TOOLCHAIN_FILE=$(pwd)/../cmake/msvc.cmake build/
SET(CMAKE_SYSTEM_NAME Windows)
-SET(CMAKE_SYSTEM_VERSION 4.0)
+SET(CMAKE_SYSTEM_VERSION 5.01)
# search for programs in the host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
@@ -11,21 +11,7 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
-#C4457: declaration of 'id' hides function parameter
-#C4456: declaration of 'i' hides previous local declaration
-#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-disable 4530 4577 4789 4244 4702 4530 4244 4127 4458 4456 4251 4100 4702 4457)
-
-add_definitions(-D_ITERATOR_DEBUG_LEVEL=0)
-add_definitions(-D_ENABLE_EXTENDED_ALIGNED_STORAGE)
-add_definitions(-D_ENABLE_ATOMIC_ALIGNMENT_FIX)
-add_definitions(-D_SILENCE_CXX17_NEGATORS_DEPRECATION_WARNING)
-add_definitions(-D_SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING)
-add_definitions(-D_SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING)
+#add_definitions(-D_ITERATOR_DEBUG_LEVEL=0)
add_definitions(-diagnostics:caret)
#add_compile_options(-Qvec-report:2)
#add_compile_options(-d2cgsummary)
@@ -33,24 +19,15 @@ add_definitions(-diagnostics:caret)
if(CMAKE_PROJECT_NAME STREQUAL "opentrack")
include("${CMAKE_CURRENT_LIST_DIR}/opentrack-policy.cmake" NO_POLICY_SCOPE)
+ add_compile_options("-W4")
+
# C4265: class has virtual functions, but destructor is not virtual
- set(warns 4265)
# C4005: macro redefinition
- set(warns-noerr 4005)
-
- foreach(i ${warns-disable})
- add_compile_options(-wd${i})
- endforeach()
+ set(warns-error 4265 4005)
- foreach(i ${warns})
+ foreach(i ${warns-error})
add_compile_options(-w1${i} -we${i})
endforeach()
-
- foreach(i ${warns-noerr})
- add_compile_options(-w1${i})
- endforeach()
-
- add_compile_options(-W4)
endif()
add_compile_options(-Zi -Zf -Zo -bigobj -cgthreads1 -vd0)
@@ -59,13 +36,12 @@ add_link_options(-cgthreads:1)
set(_CFLAGS "")
set(_CXXFLAGS "")
set(_CFLAGS_RELEASE "-O2 -O2it -Oy- -Ob3 -fp:fast -GS- -GF -GL -Gw -Gy -arch:SSE2 -GR- -MT")
-set(_CFLAGS_DEBUG "-GS -sdl -Gs -guard:cf -MTd")
+set(_CFLAGS_DEBUG "-guard:cf -MTd -Gs0 -RTCs")
set(_CXXFLAGS_RELEASE "${_CFLAGS_RELEASE}")
set(_CXXFLAGS_DEBUG "${_CFLAGS_DEBUG}")
set(_LDFLAGS_RELEASE "-OPT:REF -OPT:ICF=10 -LTCG:INCREMENTAL -DEBUG:FULL")
set(_LDFLAGS_DEBUG "-DEBUG:FULL")
-add_link_options(-DEBUGTYPE:CV,PDATA,FIXUP)
set(_LDFLAGS_STATIC "")
set(_LDFLAGS_STATIC_RELEASE "-LTCG:INCREMENTAL")
@@ -75,8 +51,13 @@ if(NOT CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE STRING "" FORCE)
endif()
+set(CMAKE_BUILD_TYPE_INIT "RELEASE" CACHE INTERNAL "")
+
string(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING "" FORCE)
+if (NOT CMAKE_BUILD_TYPE STREQUAL "RELEASE" AND NOT CMAKE_BUILD_TYPE STREQUAL "DEBUG")
+ set(CMAKE_BUILD_TYPE "RELEASE" CACHE STRING "" FORCE)
+endif()
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS RELEASE DEBUG)
foreach(k "" "_${CMAKE_BUILD_TYPE}")
diff --git a/cmake/opentrack-platform.cmake b/cmake/opentrack-platform.cmake
index 28d52962..b5c131a1 100644
--- a/cmake/opentrack-platform.cmake
+++ b/cmake/opentrack-platform.cmake
@@ -145,6 +145,21 @@ if(MSVC)
add_link_options(-WX)
add_link_options(-ignore:4020)
add_link_options(-ignore:4217) # debug build
+
+ #C4457: declaration of 'id' hides function parameter
+ #C4456: declaration of 'i' hides previous local declaration
+ #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
+ #C4200: nonstandard extension used: zero-sized array in struct/union
+
+ set(warns-disable 4530 4577 4789 4244 4702 4530 4244 4127 4458 4456 4251 4100 4702 4457 4200)
+
+ foreach(i ${warns-disable})
+ add_compile_options(-wd${i})
+ endforeach()
endif()
if(APPLE)