diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2017-06-10 12:45:28 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2017-06-10 12:45:28 +0200 |
commit | 1a4ad209341b7ef2364f7b6bc8195a4ac93838d0 (patch) | |
tree | 43f6ac1d9d6fce823c4ab850364fe8a2a1e7a1cd | |
parent | b67d81563718bd1f773f9e586b04b285e45b1208 (diff) |
cmake: don't force cache variables
-rwxr-xr-x | CMakeLists.txt | 2 | ||||
-rw-r--r-- | cmake/msvc.cmake | 39 | ||||
-rw-r--r-- | cmake/opentrack-build.cmake | 6 | ||||
-rw-r--r-- | cmake/opentrack-platform.cmake | 12 |
4 files changed, 27 insertions, 32 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 074e4011..a90720a9 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,10 +35,10 @@ set(opentrack-all-translations nl_NL ru_RU stub) include(opentrack-word-size) include(opentrack-hier) -include(opentrack-qt) include(opentrack-platform) include(opentrack-boilerplate) +include(opentrack-qt) include(opentrack-version) include(opentrack-install) 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") diff --git a/cmake/opentrack-build.cmake b/cmake/opentrack-build.cmake index 4fe8fde0..ab2bb3b8 100644 --- a/cmake/opentrack-build.cmake +++ b/cmake/opentrack-build.cmake @@ -8,13 +8,15 @@ # PERFORMANCE OF THIS SOFTWARE. if(NOT CMAKE_INSTALL_PREFIX) - set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "" FORCE) + set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install") endif() set(CMAKE_BUILD_TYPE_INIT "RELEASE") if(APPLE) - set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "" FORCE) + if(NOT CMAKE_OSX_ARCHITECTURES) + set(CMAKE_OSX_ARCHITECTURES "x86_64") + endif() endif() function(cleanup_build_dir) diff --git a/cmake/opentrack-platform.cmake b/cmake/opentrack-platform.cmake index 9d5b1abe..9c1d73a7 100644 --- a/cmake/opentrack-platform.cmake +++ b/cmake/opentrack-platform.cmake @@ -41,9 +41,10 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") endif() if(MSVC) - add_definitions(-DNOMINMAX -D_CRT_SECURE_NO_WARNINGS) - add_definitions(-D_ITERATOR_DEBUG_LEVEL=0 -D_HAS_ITERATOR_DEBUGGING=0 -D_SECURE_SCL=0) - add_definitions(-DHAS_EXCEPTIONS=0) + add_definitions(-DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS) + add_definitions(-D_ITERATOR_DEBUG_LEVEL=0 -D_ITERATOR_DEBUG_LEVEL=0) + add_definitions(-D_HAS_EXCEPTIONS=0) + set(CMAKE_CXX_FLAGS "-std:c++14 ${CMAKE_CXX_FLAGS}") if(SDK_INSTALL_DEBUG_INFO) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Zi") @@ -112,7 +113,6 @@ function(fix_flags lang flag replacement) if(".${replacement}" STREQUAL ".") set(pfx "") endif() - otr_escape_string(flag "${flag}") foreach(k _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO "") set(tmp "${CMAKE_${lang}_FLAGS${k}}") if(NOT ".${replacement}" STREQUAL ".") @@ -120,9 +120,9 @@ function(fix_flags lang flag replacement) endif() string(REGEX REPLACE "(^| )${part}${flag}(\$| )" " ${pfx}${replacement}" CMAKE_${lang}_FLAGS${k} "${CMAKE_${lang}_FLAGS${k}}") if(NOT ".${tmp}" STREQUAL ".${CMAKE_${lang}_FLAGS${k}}") - set(CMAKE_${lang}_FLAGS${k} "${CMAKE_${lang}_FLAGS${k}}" CACHE STRING "" FORCE) + set(CMAKE_${lang}_FLAGS${k} "${CMAKE_${lang}_FLAGS${k}}" CACHE STRING "") else() - set(CMAKE_${lang}_FLAGS${k} "${CMAKE_${lang}_FLAGS${k}} ${pfx}${replacement}" CACHE STRING "" FORCE) + set(CMAKE_${lang}_FLAGS${k} "${CMAKE_${lang}_FLAGS${k}} ${pfx}${replacement}" CACHE STRING "") endif() endforeach() endfunction() |