Changed: Don't use anymore the current SDK in registry (very unreliable)
Changed: Use the Windows SDK installed with VC++ or the most recent compatible one
This commit is contained in:
parent
4fee35c5b3
commit
2aba0ec52f
1 changed files with 40 additions and 20 deletions
|
@ -60,16 +60,6 @@ ELSEIF(TARGET_X86)
|
|||
SET(WINSDK8_SUFFIX "x86")
|
||||
ENDIF(TARGET_ARM)
|
||||
|
||||
GET_FILENAME_COMPONENT(WINSDKCURRENT_VERSION_REGISTRY "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentVersion]" NAME)
|
||||
|
||||
IF(WINSDKCURRENT_VERSION_REGISTRY AND NOT WINSDKCURRENT_VERSION_REGISTRY STREQUAL "/registry")
|
||||
# For previous Windows SDK, version used the short version prefixed by a "v"
|
||||
STRING(REPLACE "v" "" WINSDKCURRENT_VERSION_REGISTRY ${WINSDKCURRENT_VERSION_REGISTRY})
|
||||
IF(NOT WindowsSDK_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Current version in registry is ${WINSDKCURRENT_VERSION_REGISTRY}")
|
||||
ENDIF(NOT WindowsSDK_FIND_QUIETLY)
|
||||
ENDIF(WINSDKCURRENT_VERSION_REGISTRY AND NOT WINSDKCURRENT_VERSION_REGISTRY STREQUAL "/registry")
|
||||
|
||||
SET(WINSDKCURRENT_VERSION_INCLUDE $ENV{INCLUDE})
|
||||
|
||||
IF(WINSDKCURRENT_VERSION_INCLUDE)
|
||||
|
@ -203,23 +193,53 @@ MACRO(USE_CURRENT_WINSDK)
|
|||
FIND_WINSDK_VERSION_HEADERS()
|
||||
ENDIF(WINSDK_DIR)
|
||||
|
||||
# Use Windows SDK currently used by Visual C++
|
||||
IF(NOT WINSDK_DIR AND WINSDKCURRENT_VERSION_REGISTRY)
|
||||
IF(WINSDKCURRENT_VERSION_REGISTRY STREQUAL WINSDK7.0A_VERSION_FULL AND TARGET_X64)
|
||||
# Windows SDK 7.0A doesn't provide 64bits compilers, use SDK 7.1 for 64 bits
|
||||
SET(WINSDKCURRENT_VERSION_REGISTRY "${WINSDK7.1_VERSION_FULL}")
|
||||
ENDIF(WINSDKCURRENT_VERSION_REGISTRY STREQUAL WINSDK7.0A_VERSION_FULL AND TARGET_X64)
|
||||
IF(NOT WINSDK_DIR)
|
||||
# Use Windows SDK versions installed with VC++ when possible
|
||||
IF(MSVC12)
|
||||
SET(WINSDK_VERSION "8.1A")
|
||||
ELSEIF(MSVC11)
|
||||
SET(WINSDK_VERSION "8.0A")
|
||||
ELSEIF(MSVC10)
|
||||
IF(NOT TARGET_X64 OR NOT MSVC_EXPRESS)
|
||||
SET(WINSDK_VERSION "7.0A")
|
||||
ENDIF(NOT TARGET_X64 OR NOT MSVC_EXPRESS)
|
||||
ELSEIF(MSVC90)
|
||||
IF(NOT MSVC_EXPRESS)
|
||||
SET(WINSDK_VERSION "6.0A")
|
||||
ENDIF(NOT MSVC_EXPRESS)
|
||||
ELSEIF(MSVC80)
|
||||
IF(NOT MSVC_EXPRESS)
|
||||
# TODO: fix this version
|
||||
SET(WINSDK_VERSION "5.2A")
|
||||
ENDIF(NOT MSVC_EXPRESS)
|
||||
ELSE(MSVC12)
|
||||
MESSAGE(FATAL_ERROR "Your compiler is either too old or too recent, please update this CMake module.")
|
||||
ENDIF(MSVC12)
|
||||
|
||||
# Use installed Windows SDK
|
||||
IF(NOT WINSDK_VERSION)
|
||||
IF(WINSDK7.1_FOUND)
|
||||
SET(WINSDK_VERSION "7.1")
|
||||
ELSEIF(WINSDK7.0_FOUND)
|
||||
SET(WINSDK_VERSION "7.0")
|
||||
ELSEIF(WINSDK6.1_FOUND)
|
||||
SET(WINSDK_VERSION "6.1")
|
||||
ELSEIF(WINSDK6.0_FOUND)
|
||||
SET(WINSDK_VERSION "6.0")
|
||||
ELSE(WINSDK7.1_FOUND)
|
||||
MESSAGE(FATAL_ERROR "You have no compatible Windows SDK installed.")
|
||||
ENDIF(WINSDK7.1_FOUND)
|
||||
ENDIF(NOT WINSDK_VERSION)
|
||||
|
||||
# Look for correct registered Windows SDK version
|
||||
FOREACH(_VERSION ${WINSDK_DETECTED_VERSIONS})
|
||||
IF(WINSDKCURRENT_VERSION_REGISTRY STREQUAL WINSDK${_VERSION}_VERSION_FULL OR WINSDKCURRENT_VERSION_REGISTRY STREQUAL _VERSION)
|
||||
SET(WINSDK_VERSION ${_VERSION})
|
||||
IF(WINSDK_VERSION STREQUAL _VERSION)
|
||||
SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}")
|
||||
SET(WINSDK_DIR "${WINSDK${WINSDK_VERSION}_DIR}")
|
||||
BREAK()
|
||||
ENDIF(WINSDKCURRENT_VERSION_REGISTRY STREQUAL WINSDK${_VERSION}_VERSION_FULL OR WINSDKCURRENT_VERSION_REGISTRY STREQUAL _VERSION)
|
||||
ENDIF(WINSDK_VERSION STREQUAL _VERSION)
|
||||
ENDFOREACH(_VERSION)
|
||||
ENDIF(NOT WINSDK_DIR AND WINSDKCURRENT_VERSION_REGISTRY)
|
||||
ENDIF(NOT WINSDK_DIR)
|
||||
ENDMACRO(USE_CURRENT_WINSDK)
|
||||
|
||||
IF(WINSDK_VERSION STREQUAL "CURRENT")
|
||||
|
|
Loading…
Reference in a new issue