aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShane King <kde@dontletsstart.com>2007-12-18 05:18:55 +0000
committerShane King <kde@dontletsstart.com>2007-12-18 05:18:55 +0000
commit7597bda2d684517c684d7d0493d8fb436ea772fd (patch)
tree3c84c0ae2c1b222e32aa4f6a293b4d47770fb6d9
parenteba6f80e85fc4f218b73fbe7cf0e99ce640d843a (diff)
downloadextra-cmake-modules-7597bda2d684517c684d7d0493d8fb436ea772fd.tar.gz
extra-cmake-modules-7597bda2d684517c684d7d0493d8fb436ea772fd.tar.bz2
Fixup for the nodefault lib msvc stuff, it now uses the same method we use in FindQt4 for setting flags via a macro and forcing them to the cache. This should allow it to work with the .sln generator too.
svn path=/trunk/KDE/kdelibs/; revision=749881
-rw-r--r--modules/FindKDE4Internal.cmake25
1 files changed, 12 insertions, 13 deletions
diff --git a/modules/FindKDE4Internal.cmake b/modules/FindKDE4Internal.cmake
index 07354e7d..dcb1880e 100644
--- a/modules/FindKDE4Internal.cmake
+++ b/modules/FindKDE4Internal.cmake
@@ -800,22 +800,21 @@ if (CMAKE_SYSTEM_NAME MATCHES BSD)
endif (CMAKE_SYSTEM_NAME MATCHES BSD)
# compiler specific stuff, maybe this should be done differently, Alex
+MACRO(KDE_CHECK_FLAG_EXISTS FLAG VAR DOC)
+ IF(NOT ${VAR} MATCHES "${FLAG}")
+ SET(${VAR} "${${VAR}} ${FLAG}"
+ CACHE STRING "Flags used by the linker during ${DOC} builds." FORCE)
+ ENDIF(NOT ${VAR} MATCHES "${FLAG}")
+ENDMACRO(KDE_CHECK_FLAG_EXISTS FLAG VAR)
if (MSVC)
set (KDE4_ENABLE_EXCEPTIONS -EHsc)
- # check if release mode
- if (CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
- set (releaseMode 1)
- else (CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
- set (releaseMode 0)
- endif (CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
-
- # make sure that no header adds libcmt by default using #pragma comment(lib, "libcmt.lib") as done by mfc/afx.h
- if (releaseMode)
- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:libcmt /DEFAULTLIB:msvcrt")
- else (releaseMode)
- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:libcmtd /DEFAULTLIB:msvcrtd")
- endif (releaseMode)
+
+ # make sure that no header adds libcmt by default using #pragma comment(lib, "libcmt.lib") as done by mfc/afx.h
+ KDE_CHECK_FLAG_EXISTS("/NODEFAULTLIB:libcmt /DEFAULTLIB:msvcrt" CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "Release with Debug Info")
+ KDE_CHECK_FLAG_EXISTS("/NODEFAULTLIB:libcmt /DEFAULTLIB:msvcrt" CMAKE_EXE_LINKER_FLAGS_RELEASE "release")
+ KDE_CHECK_FLAG_EXISTS("/NODEFAULTLIB:libcmt /DEFAULTLIB:msvcrt" CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "release minsize")
+ KDE_CHECK_FLAG_EXISTS("/NODEFAULTLIB:libcmtd /DEFAULTLIB:msvcrtd" CMAKE_EXE_LINKER_FLAGS_DEBUG "debug")
endif(MSVC)