summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-08-23 13:21:26 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-08-23 13:21:26 +0200
commitb9f47fb7ce145b568e81ff4798ca0fb2ab119022 (patch)
treeb8fa9c4a4cb72f94085cf27f688565159d32fc6c
parente28c988a04c15c2cedfe7e069a066463f4e4c452 (diff)
cmake/msvc: prevent warning when passing shared flags to static libs
-rw-r--r--cmake/msvc.cmake17
1 files changed, 12 insertions, 5 deletions
diff --git a/cmake/msvc.cmake b/cmake/msvc.cmake
index 0ecf477a..61932d42 100644
--- a/cmake/msvc.cmake
+++ b/cmake/msvc.cmake
@@ -13,9 +13,8 @@ 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 /MD /Y- /Zi /MP /W1")
-set(link "/DEBUG /LTCG /OPT:REF,ICF=10 /DYNAMICBASE /NXCOMPAT")
-set(silly "-DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -D_ITERATOR_DEBUG_LEVEL=0 -D_HAS_ITERATOR_DEBUGGING=0 -D_SECURE_SCL=0")
+set(silly "/bigobj -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}")
@@ -24,9 +23,17 @@ set(_CFLAGS_DEBUG "/Zi /GS")
set(_CXXFLAGS_RELEASE "${cc}")
set(_CXXFLAGS_DEBUG "/Zi /GS")
+set(ldflags-shared-release "/OPT:REF,ICF=10")
+set(ldflags-shared "/DEBUG /DYNAMICBASE /NXCOMPAT")
+
+foreach (i MODULE EXE SHARED)
+ set(_LDFLAGS_${i} "${ldflags-shared}")
+ set(_LDFLAGS_${i}_RELEASE "${ldflags-shared-release}")
+endforeach()
+
set(_LDFLAGS "")
-set(_LDFLAGS_RELEASE "${link}")
-set(_LDFLAGS_DEBUG "/DEBUG /DYNAMICBASE /NXCOMPAT")
+set(_LDFLAGS_RELEASE "/LTCG")
+set(_LDFLAGS_DEBUG "")
foreach(j C CXX)
foreach(i "" _DEBUG _RELEASE)
@@ -39,7 +46,7 @@ endforeach()
foreach(j "" _DEBUG _RELEASE)
foreach(i MODULE EXE SHARED STATIC)
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}} ${_LDFLAGS_${i}} ${_LDFLAGS_${i}_${j}} ${OVERRIDE_LDFLAGS${j}}" CACHE STRING "" FORCE)
endforeach()
endforeach()