Changed: Better support for Visual C++ 2017

--HG--
branch : develop
hg/compatibility-develop
kervala 7 years ago
parent 8c46a655c6
commit 8c253955b7

@ -56,16 +56,18 @@ MACRO(DETECT_VC_VERSION_HELPER _ROOT _VERSION)
ENDMACRO()
MACRO(DETECT_VC_VERSION _VERSION)
SET(VC${_VERSION}_FOUND OFF)
DETECT_VC_VERSION_HELPER("HKEY_CURRENT_USER" ${_VERSION})
IF(NOT VC_FOUND)
SET(VC${_VERSION}_FOUND OFF)
DETECT_VC_VERSION_HELPER("HKEY_CURRENT_USER" ${_VERSION})
IF(NOT VC${_VERSION}_FOUND)
DETECT_VC_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION})
ENDIF()
IF(NOT VC${_VERSION}_FOUND)
DETECT_VC_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION})
ENDIF()
IF(VC${_VERSION}_FOUND)
SET(VC_FOUND ON)
SET(VC_DIR "${VC${_VERSION}_DIR}")
IF(VC${_VERSION}_FOUND)
SET(VC_FOUND ON)
SET(VC_DIR "${VC${_VERSION}_DIR}")
ENDIF()
ENDIF()
ENDMACRO()
@ -77,7 +79,7 @@ MACRO(DETECT_EXPRESS_VERSION _VERSION)
ENDIF()
ENDMACRO()
IF(MSVC1411 OR MSVC1410)
IF(MSVC_VERSION GREATER 1909)
DETECT_VC_VERSION("15.0")
SET(MSVC_TOOLSET "140")
@ -98,44 +100,18 @@ IF(MSVC1411 OR MSVC1410)
SET(VC_DIR "${VC_DIR}/${MSVC_TOOLCHAIN_VERSION}")
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)
DETECT_VC_VERSION("14.0")
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)
DETECT_VC_VERSION("12.0")
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)
DETECT_VC_VERSION("11.0")
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)
DETECT_VC_VERSION("10.0")
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)
DETECT_VC_VERSION("9.0")
SET(MSVC_TOOLSET "90")
@ -147,6 +123,8 @@ ENDIF()
# If you plan to use VC++ compilers with WINE, set VC_DIR environment variable
IF(NOT VC_DIR)
SET(VC_DIR $ENV{VC_DIR})
# Fix path
FILE(TO_CMAKE_PATH ${VC_DIR} VC_DIR)
ENDIF()
IF(NOT VC_DIR)
@ -158,8 +136,44 @@ IF(NOT VC_DIR)
STRING(REGEX REPLACE "/(bin|BIN|Bin)/.+" "" VC_DIR ${_COMPILER})
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")
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()
MESSAGE(STATUS "Using headers from ${VC_INCLUDE_DIR}")

@ -240,7 +240,7 @@ MACRO(USE_CURRENT_WINSDK)
IF(NOT WINSDK_DIR)
# Use Windows SDK versions installed with VC++ when possible
IF(MSVC1411 OR MSVC1410)
IF(MSVC_VERSION GREATER 1909)
# Special case, use Kits for SDK
SET(WINSDK_VERSION "10.0")
SET(WINSDK_DIR ${WINSDK_UCRT_DIR})
@ -484,7 +484,7 @@ IF(WINSDK_INCLUDE_DIR)
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))
ADD_DEFINITIONS(-D_USING_V110_SDK71_)
ENDIF()

Loading…
Cancel
Save