|
|
|
@ -45,24 +45,35 @@ ELSE()
|
|
|
|
|
|
|
|
|
|
IF(MSVC_VERSION LESS 1920)
|
|
|
|
|
SET(_NAME "2017")
|
|
|
|
|
ELSE()
|
|
|
|
|
ELSEIF(MSVC_VERSION LESS 1930)
|
|
|
|
|
SET(_NAME "2019")
|
|
|
|
|
ELSE()
|
|
|
|
|
SET(_NAME "2022")
|
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
STRING(REGEX REPLACE "/MSVC/.+" "/MSVC" VC_DIR ${_COMPILER})
|
|
|
|
|
|
|
|
|
|
FILE(GLOB MSVC_TOOLCHAIN_VERSIONS RELATIVE ${VC_DIR} "${VC_DIR}/*")
|
|
|
|
|
IF(DEFINED ENV{VCToolsVersion})
|
|
|
|
|
|
|
|
|
|
SET(MSVC_TOOLCHAIN_VERSION $ENV{VCToolsVersion})
|
|
|
|
|
|
|
|
|
|
ELSE()
|
|
|
|
|
|
|
|
|
|
IF(MSVC_TOOLCHAIN_VERSIONS)
|
|
|
|
|
LIST(SORT MSVC_TOOLCHAIN_VERSIONS)
|
|
|
|
|
LIST(REVERSE MSVC_TOOLCHAIN_VERSIONS)
|
|
|
|
|
ENDIF()
|
|
|
|
|
FILE(GLOB MSVC_TOOLCHAIN_VERSIONS RELATIVE ${VC_DIR} "${VC_DIR}/*")
|
|
|
|
|
|
|
|
|
|
IF(MSVC_TOOLCHAIN_VERSIONS)
|
|
|
|
|
LIST(GET MSVC_TOOLCHAIN_VERSIONS 0 MSVC_TOOLCHAIN_VERSION)
|
|
|
|
|
IF(MSVC_TOOLCHAIN_VERSIONS)
|
|
|
|
|
LIST(SORT MSVC_TOOLCHAIN_VERSIONS)
|
|
|
|
|
LIST(REVERSE MSVC_TOOLCHAIN_VERSIONS)
|
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
SET(VC_DIR "${VC_DIR}/${MSVC_TOOLCHAIN_VERSION}")
|
|
|
|
|
IF(MSVC_TOOLCHAIN_VERSIONS)
|
|
|
|
|
LIST(GET MSVC_TOOLCHAIN_VERSIONS 0 MSVC_TOOLCHAIN_VERSION)
|
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
IF (MSVC_TOOLCHAIN_VERSION)
|
|
|
|
|
SET(VC_DIR "${VC_DIR}/${MSVC_TOOLCHAIN_VERSION}")
|
|
|
|
|
MESSAGE(STATUS "Found Visual C++ ${_NAME} (${_VERSION} with toolchain ${MSVC_TOOLCHAIN_VERSION}) in ${VC_DIR}")
|
|
|
|
|
ELSE()
|
|
|
|
|
MESSAGE(FATAL_ERROR "Unable to find Visual C++ in ${VC_DIR}")
|
|
|
|
|