mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-14 12:57:59 +08:00
[vcpkg-toolchain] Automatically detect Windows SDK version.
This commit is contained in:
parent
b01e4cb551
commit
85169faaea
@ -39,8 +39,9 @@ if(NOT VCPKG_TOOLCHAIN)
|
||||
endif()
|
||||
|
||||
set(VCPKG_TARGET_TRIPLET ${_VCPKG_TARGET_TRIPLET_ARCH}-${_VCPKG_TARGET_TRIPLET_PLAT} CACHE STRING "Vcpkg target triplet (ex. x86-windows)")
|
||||
set(_VCPKG_INSTALLED_DIR ${CMAKE_CURRENT_LIST_DIR}/../../installed)
|
||||
set(_VCPKG_TOOLCHAIN_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||
get_filename_component(_VCPKG_ROOT_DIR ${_VCPKG_TOOLCHAIN_DIR}/../.. ABSOLUTE)
|
||||
set(_VCPKG_INSTALLED_DIR ${_VCPKG_ROOT_DIR}/installed)
|
||||
|
||||
if(CMAKE_BUILD_TYPE MATCHES "^Debug$" OR NOT DEFINED CMAKE_BUILD_TYPE)
|
||||
list(APPEND CMAKE_PREFIX_PATH
|
||||
@ -59,6 +60,15 @@ if(NOT VCPKG_TOOLCHAIN)
|
||||
|
||||
set(Boost_COMPILER "-vc140")
|
||||
|
||||
if (NOT DEFINED CMAKE_SYSTEM_VERSION)
|
||||
include(${_VCPKG_ROOT_DIR}/scripts/cmake/vcpkg_get_windows_sdk.cmake)
|
||||
# This is used as an implicit parameter for vcpkg_get_windows_sdk
|
||||
set(VCPKG_ROOT_DIR ${_VCPKG_ROOT_DIR})
|
||||
vcpkg_get_windows_sdk(WINDOWS_SDK_VERSION)
|
||||
unset(VCPKG_ROOT_DIR)
|
||||
set(CMAKE_SYSTEM_VERSION ${WINDOWS_SDK_VERSION})
|
||||
endif()
|
||||
|
||||
file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles)
|
||||
set(CMAKE_SYSTEM_IGNORE_PATH
|
||||
"${_programfiles}/OpenSSL"
|
||||
|
@ -1,10 +1,11 @@
|
||||
# Returns Windows SDK number via out variable "ret"
|
||||
function(vcpkg_get_windows_sdk ret)
|
||||
execute_process(
|
||||
COMMAND powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "& {& '${VCPKG_ROOT_DIR}/scripts/getWindowsSDK.ps1'}" 2>&1
|
||||
OUTPUT_VARIABLE WINDOWS_SDK
|
||||
RESULT_VARIABLE error_code)
|
||||
|
||||
if (${error_code})
|
||||
if (error_code)
|
||||
message(FATAL_ERROR "Could not find Windows SDK")
|
||||
endif()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user