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

@ -41,7 +41,7 @@ IF(EXTERNAL_PATH)
ELSE(TARGET_X64)
SET(EXTERNAL_BINARY_PATH "${EXTERNAL_PATH}/bin")
ENDIF(TARGET_X64)
# Using 32 or 64 bits libraries
IF(TARGET_X64)
SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib64")

View file

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

View file

@ -37,9 +37,7 @@ ENDMACRO(NL_TARGET_DRIVER)
# Argument:
###
MACRO(NL_DEFAULT_PROPS name label)
IF(NOT MSVC10)
SET_TARGET_PROPERTIES(${name} PROPERTIES PROJECT_LABEL ${label})
ENDIF(NOT MSVC10)
SET_TARGET_PROPERTIES(${name} PROPERTIES PROJECT_LABEL ${label})
GET_TARGET_PROPERTY(type ${name} TYPE)
IF(${type} STREQUAL 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})
ENDIF(NL_LIB_PREFIX)
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)
SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "/X")
ENDIF(WITH_STLPORT AND WIN32)
@ -308,25 +315,32 @@ MACRO(NL_SETUP_BUILD)
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
# ADD_DEFINITIONS(-DHAVE_IA64)
# ENDIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86")
IF(WIN32)
IF(MSVC10)
# /Ox is working with VC++ 2010, but custom optimizations don't exist
SET(SPEED_OPTIMIZATIONS "/Ox /GF /GS-")
# without inlining it's unusable, use custom optimizations again
SET(MIN_OPTIMIZATIONS "/Od /Ob1")
ELSE(MSVC10)
ELSEIF(MSVC90)
# don't use a /O[012x] flag if you want custom optimizations
SET(SPEED_OPTIMIZATIONS "/Ob2 /Oi /Ot /Oy /GT /GF /GS-")
# without inlining it's unusable, use custom optimizations again
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)
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
SET(PLATFORM_LINKFLAGS "-DEBUG")
IF(TARGET_X64)
# Fix a bug with Intellisense
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} /D_WIN64")
@ -504,6 +518,10 @@ MACRO(SETUP_EXTERNAL)
INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake)
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)
# VC_ROOT_DIR is set to "registry" when a key is not found
IF(VC_ROOT_DIR MATCHES "registry")