summaryrefslogtreecommitdiffhomepage
path: root/cmake/msvc.cmake
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-06-10 12:45:28 +0200
committerStanislaw Halik <sthalik@misaki.pl>2017-06-10 12:45:28 +0200
commit1a4ad209341b7ef2364f7b6bc8195a4ac93838d0 (patch)
tree43f6ac1d9d6fce823c4ab850364fe8a2a1e7a1cd /cmake/msvc.cmake
parentb67d81563718bd1f773f9e586b04b285e45b1208 (diff)
cmake: don't force cache variables
Diffstat (limited to 'cmake/msvc.cmake')
-rw-r--r--cmake/msvc.cmake39
1 files changed, 16 insertions, 23 deletions
diff --git a/cmake/msvc.cmake b/cmake/msvc.cmake
index e5912f46..f5915d99 100644
--- a/cmake/msvc.cmake
+++ b/cmake/msvc.cmake
@@ -12,12 +12,11 @@ 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 "/O2it /Ob2 /fp:fast /GS- /GF /GL /Gw /Gy")
+set(cc "/O2 /O2it /Ob2 /fp:fast /GS- /GF /GL /Gw /Gy /Gm /Zc:inline /Zo /FS /Zc:implicitNoexcept /Zc:threadSafeInit")
set(warns_ "")
-#C4244: 'return': conversion from '__int64' to 'long', possible loss of data
-set(warns-disable 4530 4577 4789 4244)
+set(warns-disable 4530 4577 4789 4244 4702)
foreach(i ${warns-disable})
set(warns_ "${warns_} /wd${i}")
@@ -43,59 +42,53 @@ if(CMAKE_PROJECT_NAME STREQUAL "opentrack")
set(cc "${cc} /GR- /arch:SSE2")
endif()
-set(silly "${warns_} -MT -Gm -Zi")
+set(base-cflags "${warns_} -MT -Zi")
-set(_CFLAGS "${silly}")
-set(_CXXFLAGS "${silly}")
+set(_CFLAGS "${base-cflags}")
+set(_CXXFLAGS "${base-cflags}")
set(_CFLAGS_RELEASE "${cc}")
set(_CFLAGS_DEBUG "/GS /sdl /Gs /guard:cf")
set(_CXXFLAGS_RELEASE "${cc}")
set(_CXXFLAGS_DEBUG "${_CFLAGS_DEBUG}")
-set(_LDFLAGS "")
+set(_LDFLAGS "/machine:X86 /DEBUG")
set(_LDFLAGS_RELEASE "/LTCG:INCREMENTAL /OPT:REF /OPT:ICF=10")
set(_LDFLAGS_DEBUG "")
-set(_LDFLAGS_STATIC "/WX")
+set(_LDFLAGS_STATIC "/machine:X86 /WX")
set(_LDFLAGS_STATIC_RELEASE "/LTCG:INCREMENTAL")
set(_LDFLAGS_STATIC_DEBUG "")
foreach(j C CXX)
foreach(i "" _DEBUG _RELEASE)
- set(OVERRIDE_${j}_FLAGS${i} "" CACHE STRING "")
- set(CMAKE_${j}_FLAGS${i} "${_${j}FLAGS${i}} ${OVERRIDE_${j}_FLAGS${i}}" CACHE STRING "" FORCE)
+ set(CMAKE_${j}_FLAGS${i} "${_${j}FLAGS${i}} ${CMAKE_${j}_FLAGS${i}}")
endforeach()
- set(CMAKE_${j}_FLAGS "${_${j}FLAGS} ${_${j}_WARNS} ${OVERRIDE_${j}_FLAGS}" CACHE STRING "" FORCE)
+ set(CMAKE_${j}_FLAGS "${_${j}FLAGS} ${_${j}_WARNS} ${CMAKE_${j}_FLAGS}")
endforeach()
foreach(j "" _DEBUG _RELEASE)
foreach(i MODULE EXE SHARED)
- set(OVERRIDE_LDFLAGS${j} "" CACHE STRING "")
- set(CMAKE_${i}_LINKER_FLAGS${j} "${_LDFLAGS${j}} ${OVERRIDE_LDFLAGS${j}}" CACHE STRING "" FORCE)
+ set(CMAKE_${i}_LINKER_FLAGS${j} "${_LDFLAGS${j}} ${CMAKE_${i}_LINKER_FLAGS${j}}")
endforeach()
endforeach()
-set(OVERRIDE_LDFLAGS_STATIC "" CACHE STRING "")
-set(OVERRIDE_LDFLAGS_STATIC_RELEASE "" CACHE STRING "")
-set(OVERRIDE_LDFLAGS_STATIC_DEBUG "" CACHE STRING "")
-
-set(CMAKE_STATIC_LINKER_FLAGS "${_LDFLAGS_STATIC} ${OVERRIDE_LDFLAGS_STATIC}" CACHE STRING "" FORCE)
-set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${_LDFLAGS_STATIC_RELEASE} ${OVERRIDE_LDFLAGS_STATIC_RELEASE}" CACHE STRING "" FORCE)
-set(CMAKE_STATIC_LINKER_FLAGS_DEBUG "${_LDFLAGS_STATIC_DEBUG} ${OVERRIDE_LDFLAGS_STATIC_DEBUG}" CACHE STRING "" FORCE)
+set(CMAKE_STATIC_LINKER_FLAGS "${_LDFLAGS_STATIC} ${CMAKE_STATIC_LINKER_FLAGS}")
+set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${_LDFLAGS_STATIC_RELEASE} ${CMAKE_STATIC_LINKER_FLAGS_RELEASE}")
+set(CMAKE_STATIC_LINKER_FLAGS_DEBUG "${_LDFLAGS_STATIC_DEBUG} ${CMAKE_STATIC_LINKER_FLAGS_DEBUG}")
set(CMAKE_BUILD_TYPE_INIT RELEASE)
# for nmake/jom build directories
if(NOT CMAKE_BUILD_TYPE)
- set(CMAKE_BUILD_TYPE "RELEASE" CACHE STRING "" FORCE)
+ set(CMAKE_BUILD_TYPE "RELEASE")
endif()
if(CMAKE_PROJECT_NAME STREQUAL "opentrack")
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)
+ set(${i} "-W3 ${${i}}")
endif()
endforeach()
endif()
-set(CMAKE_RC_FLAGS "-nologo -DWIN32" CACHE STRING "" FORCE)
+set(CMAKE_RC_FLAGS "-nologo -DWIN32")