Changed: Better support for Visual C++ 2017
--HG-- branch : develop
This commit is contained in:
parent
8c46a655c6
commit
8c253955b7
2 changed files with 52 additions and 38 deletions
|
@ -56,6 +56,7 @@ MACRO(DETECT_VC_VERSION_HELPER _ROOT _VERSION)
|
||||||
ENDMACRO()
|
ENDMACRO()
|
||||||
|
|
||||||
MACRO(DETECT_VC_VERSION _VERSION)
|
MACRO(DETECT_VC_VERSION _VERSION)
|
||||||
|
IF(NOT VC_FOUND)
|
||||||
SET(VC${_VERSION}_FOUND OFF)
|
SET(VC${_VERSION}_FOUND OFF)
|
||||||
DETECT_VC_VERSION_HELPER("HKEY_CURRENT_USER" ${_VERSION})
|
DETECT_VC_VERSION_HELPER("HKEY_CURRENT_USER" ${_VERSION})
|
||||||
|
|
||||||
|
@ -67,6 +68,7 @@ MACRO(DETECT_VC_VERSION _VERSION)
|
||||||
SET(VC_FOUND ON)
|
SET(VC_FOUND ON)
|
||||||
SET(VC_DIR "${VC${_VERSION}_DIR}")
|
SET(VC_DIR "${VC${_VERSION}_DIR}")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
ENDMACRO()
|
ENDMACRO()
|
||||||
|
|
||||||
MACRO(DETECT_EXPRESS_VERSION _VERSION)
|
MACRO(DETECT_EXPRESS_VERSION _VERSION)
|
||||||
|
@ -77,7 +79,7 @@ MACRO(DETECT_EXPRESS_VERSION _VERSION)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDMACRO()
|
ENDMACRO()
|
||||||
|
|
||||||
IF(MSVC1411 OR MSVC1410)
|
IF(MSVC_VERSION GREATER 1909)
|
||||||
DETECT_VC_VERSION("15.0")
|
DETECT_VC_VERSION("15.0")
|
||||||
SET(MSVC_TOOLSET "140")
|
SET(MSVC_TOOLSET "140")
|
||||||
|
|
||||||
|
@ -98,44 +100,18 @@ IF(MSVC1411 OR MSVC1410)
|
||||||
|
|
||||||
SET(VC_DIR "${VC_DIR}/${MSVC_TOOLCHAIN_VERSION}")
|
SET(VC_DIR "${VC_DIR}/${MSVC_TOOLCHAIN_VERSION}")
|
||||||
SET(VC_INCLUDE_DIR "${VC_DIR}/include")
|
SET(VC_INCLUDE_DIR "${VC_DIR}/include")
|
||||||
|
|
||||||
IF(NOT MSVC14_REDIST_DIR)
|
|
||||||
# If you have VC++ 2017 Express, put x64/Microsoft.VC141.CRT/*.dll in ${EXTERNAL_PATH}/redist
|
|
||||||
# original files whould be in ${VC_DIR}/Redist/MSVC/14.11.25325/x64/Microsoft.VC141.CRT
|
|
||||||
SET(MSVC14_REDIST_DIR "${EXTERNAL_PATH}/redist")
|
|
||||||
ENDIF()
|
|
||||||
ELSEIF(MSVC14)
|
ELSEIF(MSVC14)
|
||||||
DETECT_VC_VERSION("14.0")
|
DETECT_VC_VERSION("14.0")
|
||||||
SET(MSVC_TOOLSET "140")
|
SET(MSVC_TOOLSET "140")
|
||||||
|
|
||||||
IF(NOT MSVC14_REDIST_DIR)
|
|
||||||
# If you have VC++ 2015 Express, put x64/Microsoft.VC140.CRT/*.dll in ${EXTERNAL_PATH}/redist
|
|
||||||
SET(MSVC14_REDIST_DIR "${EXTERNAL_PATH}/redist")
|
|
||||||
ENDIF()
|
|
||||||
ELSEIF(MSVC12)
|
ELSEIF(MSVC12)
|
||||||
DETECT_VC_VERSION("12.0")
|
DETECT_VC_VERSION("12.0")
|
||||||
SET(MSVC_TOOLSET "120")
|
SET(MSVC_TOOLSET "120")
|
||||||
|
|
||||||
IF(NOT MSVC12_REDIST_DIR)
|
|
||||||
# If you have VC++ 2013 Express, put x64/Microsoft.VC120.CRT/*.dll in ${EXTERNAL_PATH}/redist
|
|
||||||
SET(MSVC12_REDIST_DIR "${EXTERNAL_PATH}/redist")
|
|
||||||
ENDIF()
|
|
||||||
ELSEIF(MSVC11)
|
ELSEIF(MSVC11)
|
||||||
DETECT_VC_VERSION("11.0")
|
DETECT_VC_VERSION("11.0")
|
||||||
SET(MSVC_TOOLSET "110")
|
SET(MSVC_TOOLSET "110")
|
||||||
|
|
||||||
IF(NOT MSVC11_REDIST_DIR)
|
|
||||||
# If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist
|
|
||||||
SET(MSVC11_REDIST_DIR "${EXTERNAL_PATH}/redist")
|
|
||||||
ENDIF()
|
|
||||||
ELSEIF(MSVC10)
|
ELSEIF(MSVC10)
|
||||||
DETECT_VC_VERSION("10.0")
|
DETECT_VC_VERSION("10.0")
|
||||||
SET(MSVC_TOOLSET "100")
|
SET(MSVC_TOOLSET "100")
|
||||||
|
|
||||||
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()
|
|
||||||
ELSEIF(MSVC90)
|
ELSEIF(MSVC90)
|
||||||
DETECT_VC_VERSION("9.0")
|
DETECT_VC_VERSION("9.0")
|
||||||
SET(MSVC_TOOLSET "90")
|
SET(MSVC_TOOLSET "90")
|
||||||
|
@ -147,6 +123,8 @@ ENDIF()
|
||||||
# If you plan to use VC++ compilers with WINE, set VC_DIR environment variable
|
# If you plan to use VC++ compilers with WINE, set VC_DIR environment variable
|
||||||
IF(NOT VC_DIR)
|
IF(NOT VC_DIR)
|
||||||
SET(VC_DIR $ENV{VC_DIR})
|
SET(VC_DIR $ENV{VC_DIR})
|
||||||
|
# Fix path
|
||||||
|
FILE(TO_CMAKE_PATH ${VC_DIR} VC_DIR)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(NOT VC_DIR)
|
IF(NOT VC_DIR)
|
||||||
|
@ -158,8 +136,44 @@ IF(NOT VC_DIR)
|
||||||
STRING(REGEX REPLACE "/(bin|BIN|Bin)/.+" "" VC_DIR ${_COMPILER})
|
STRING(REGEX REPLACE "/(bin|BIN|Bin)/.+" "" VC_DIR ${_COMPILER})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(NOT VC_INCLUDE_DIR)
|
IF(NOT VC_INCLUDE_DIR AND VC_DIR AND EXISTS "${VC_DIR}")
|
||||||
SET(VC_INCLUDE_DIR "${VC_DIR}/include")
|
SET(VC_INCLUDE_DIR "${VC_DIR}/include")
|
||||||
|
IF(EXISTS "${VC_INCLUDE_DIR}")
|
||||||
|
SET(VC_FOUND ON)
|
||||||
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
SET(MSVC_REDIST_DIR "${EXTERNAL_PATH}/redist")
|
||||||
|
|
||||||
|
IF(NOT EXISTS "${MSVC_REDIST_DIR}")
|
||||||
|
SET(MSVC_REDIST_DIR "${VC_DIR}/redist")
|
||||||
|
|
||||||
|
IF(NOT EXISTS "${MSVC_REDIST_DIR}")
|
||||||
|
SET(MSVC_REDIST_DIR)
|
||||||
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
IF(MSVC_REDIST_DIR)
|
||||||
|
IF(MSVC1411 OR MSVC1410)
|
||||||
|
# If you have VC++ 2017 Express, put x64/Microsoft.VC141.CRT/*.dll in ${EXTERNAL_PATH}/redist
|
||||||
|
# original files whould be in ${VC_DIR}/Redist/MSVC/14.11.25325/x64/Microsoft.VC141.CRT
|
||||||
|
SET(MSVC14_REDIST_DIR "${MSVC_REDIST_DIR}")
|
||||||
|
ELSEIF(MSVC14)
|
||||||
|
SET(MSVC14_REDIST_DIR "${MSVC_REDIST_DIR}")
|
||||||
|
ELSEIF(MSVC12)
|
||||||
|
# If you have VC++ 2013 Express, put x64/Microsoft.VC120.CRT/*.dll in ${EXTERNAL_PATH}/redist
|
||||||
|
SET(MSVC12_REDIST_DIR "${MSVC_REDIST_DIR}")
|
||||||
|
ELSEIF(MSVC11)
|
||||||
|
# If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist
|
||||||
|
SET(MSVC11_REDIST_DIR "${MSVC_REDIST_DIR}")
|
||||||
|
ELSEIF(MSVC10)
|
||||||
|
# If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist
|
||||||
|
SET(MSVC10_REDIST_DIR "${MSVC_REDIST_DIR}")
|
||||||
|
ELSEIF(MSVC90)
|
||||||
|
SET(MSVC90_REDIST_DIR "${MSVC_REDIST_DIR}")
|
||||||
|
ELSEIF(MSVC80)
|
||||||
|
SET(MSVC80_REDIST_DIR "${MSVC_REDIST_DIR}")
|
||||||
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
MESSAGE(STATUS "Using headers from ${VC_INCLUDE_DIR}")
|
MESSAGE(STATUS "Using headers from ${VC_INCLUDE_DIR}")
|
||||||
|
|
|
@ -240,7 +240,7 @@ MACRO(USE_CURRENT_WINSDK)
|
||||||
|
|
||||||
IF(NOT WINSDK_DIR)
|
IF(NOT WINSDK_DIR)
|
||||||
# Use Windows SDK versions installed with VC++ when possible
|
# Use Windows SDK versions installed with VC++ when possible
|
||||||
IF(MSVC1411 OR MSVC1410)
|
IF(MSVC_VERSION GREATER 1909)
|
||||||
# Special case, use Kits for SDK
|
# Special case, use Kits for SDK
|
||||||
SET(WINSDK_VERSION "10.0")
|
SET(WINSDK_VERSION "10.0")
|
||||||
SET(WINSDK_DIR ${WINSDK_UCRT_DIR})
|
SET(WINSDK_DIR ${WINSDK_UCRT_DIR})
|
||||||
|
@ -484,7 +484,7 @@ IF(WINSDK_INCLUDE_DIR)
|
||||||
|
|
||||||
SET(CMAKE_LIBRARY_PATH ${WINSDK_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH})
|
SET(CMAKE_LIBRARY_PATH ${WINSDK_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH})
|
||||||
|
|
||||||
# Fix for using Windows SDK 7.1 with Visual C++ 2012, 2013 and 2015
|
# Fix for using Windows SDK 7.1 with Visual C++ 2012, 2013, 2015 and 2017
|
||||||
IF(WINSDK_VERSION STREQUAL "7.1" AND (MSVC11 OR MSVC12 OR MSVC14))
|
IF(WINSDK_VERSION STREQUAL "7.1" AND (MSVC11 OR MSVC12 OR MSVC14))
|
||||||
ADD_DEFINITIONS(-D_USING_V110_SDK71_)
|
ADD_DEFINITIONS(-D_USING_V110_SDK71_)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
Loading…
Reference in a new issue