Changed: #1177 VS 2010 does not work under CMake

This commit is contained in:
kervala 2011-08-19 16:58:18 +02:00
parent edf48c3d05
commit 285dea2f38
3 changed files with 32 additions and 8 deletions

View file

@ -33,6 +33,12 @@ FIND_PATH(WINSDK_INCLUDE_DIR Windows.h
${WINSDKCURRENT_DIR}/Include ${WINSDKCURRENT_DIR}/Include
) )
FIND_PROGRAM(WINSDK_SIGNTOOL signtool
PATHS
${WINSDK71_DIR}/Bin
${WINSDKCURRENT_DIR}/Bin
)
IF(WINSDK_INCLUDE_DIR) IF(WINSDK_INCLUDE_DIR)
SET(WINSDK_FOUND TRUE) SET(WINSDK_FOUND TRUE)
ELSE(WINSDK_INCLUDE_DIR) ELSE(WINSDK_INCLUDE_DIR)

View file

@ -37,9 +37,7 @@ ENDMACRO(NL_TARGET_DRIVER)
# Argument: # Argument:
### ###
MACRO(NL_DEFAULT_PROPS name label) MACRO(NL_DEFAULT_PROPS name label)
IF(NOT MSVC10)
SET_TARGET_PROPERTIES(${name} PROPERTIES PROJECT_LABEL ${label}) SET_TARGET_PROPERTIES(${name} PROPERTIES PROJECT_LABEL ${label})
ENDIF(NOT MSVC10)
GET_TARGET_PROPERTY(type ${name} TYPE) GET_TARGET_PROPERTY(type ${name} TYPE)
IF(${type} STREQUAL SHARED_LIBRARY) IF(${type} STREQUAL SHARED_LIBRARY)
# Set versions only if target is a shared library # Set versions only if target is a shared library
@ -49,6 +47,15 @@ MACRO(NL_DEFAULT_PROPS name label)
SET_TARGET_PROPERTIES(${name} PROPERTIES INSTALL_NAME_DIR ${NL_LIB_PREFIX}) SET_TARGET_PROPERTIES(${name} PROPERTIES INSTALL_NAME_DIR ${NL_LIB_PREFIX})
ENDIF(NL_LIB_PREFIX) ENDIF(NL_LIB_PREFIX)
ENDIF(${type} STREQUAL SHARED_LIBRARY) ENDIF(${type} STREQUAL SHARED_LIBRARY)
IF(${type} STREQUAL EXECUTABLE AND WIN32)
SET_TARGET_PROPERTIES(${name} PROPERTIES
VERSION ${NL_VERSION}
SOVERSION ${NL_VERSION_MAJOR}
COMPILE_FLAGS "/GA"
LINK_FLAGS "/VERSION:${NL_VERSION}")
ENDIF(${type} STREQUAL EXECUTABLE AND WIN32)
IF(WITH_STLPORT AND WIN32) IF(WITH_STLPORT AND WIN32)
SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "/X") SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "/X")
ENDIF(WITH_STLPORT AND WIN32) ENDIF(WITH_STLPORT AND WIN32)
@ -315,14 +322,21 @@ MACRO(NL_SETUP_BUILD)
SET(SPEED_OPTIMIZATIONS "/Ox /GF /GS-") SET(SPEED_OPTIMIZATIONS "/Ox /GF /GS-")
# without inlining it's unusable, use custom optimizations again # without inlining it's unusable, use custom optimizations again
SET(MIN_OPTIMIZATIONS "/Od /Ob1") SET(MIN_OPTIMIZATIONS "/Od /Ob1")
ELSE(MSVC10) ELSEIF(MSVC90)
# don't use a /O[012x] flag if you want custom optimizations # don't use a /O[012x] flag if you want custom optimizations
SET(SPEED_OPTIMIZATIONS "/Ob2 /Oi /Ot /Oy /GT /GF /GS-") SET(SPEED_OPTIMIZATIONS "/Ob2 /Oi /Ot /Oy /GT /GF /GS-")
# without inlining it's unusable, use custom optimizations again # without inlining it's unusable, use custom optimizations again
SET(MIN_OPTIMIZATIONS "/Ob1") SET(MIN_OPTIMIZATIONS "/Ob1")
ELSEIF(MSVC80)
# don't use a /O[012x] flag if you want custom optimizations
SET(SPEED_OPTIMIZATIONS "/Ox /GF /GS-")
# without inlining it's unusable, use custom optimizations again
SET(MIN_OPTIMIZATIONS "/Od /Ob1")
ELSE(MSVC10)
MESSAGE(FATAL_ERROR "Can't determine compiler version ${MSVC_VERSION}")
ENDIF(MSVC10) ENDIF(MSVC10)
SET(PLATFORM_CFLAGS "/D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zi /Zm1000 /MP /Gy-") SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zi /Zm1000 /MP /Gy-")
# Common link flags # Common link flags
SET(PLATFORM_LINKFLAGS "-DEBUG") SET(PLATFORM_LINKFLAGS "-DEBUG")
@ -504,6 +518,10 @@ MACRO(SETUP_EXTERNAL)
INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake) INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake)
IF(MSVC10) IF(MSVC10)
IF(NOT MSVC10_REDIST_DIR)
# If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist
SET(MSVC10_REDIST_DIR "${EXTERNAL_PATH}/redist")
ENDIF(NOT MSVC10_REDIST_DIR)
GET_FILENAME_COMPONENT(VC_ROOT_DIR "[HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\10.0_Config;InstallDir]" ABSOLUTE) GET_FILENAME_COMPONENT(VC_ROOT_DIR "[HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\10.0_Config;InstallDir]" ABSOLUTE)
# VC_ROOT_DIR is set to "registry" when a key is not found # VC_ROOT_DIR is set to "registry" when a key is not found
IF(VC_ROOT_DIR MATCHES "registry") IF(VC_ROOT_DIR MATCHES "registry")