2017-03-22 06:48:29 +08:00
|
|
|
# Returns Windows SDK number via out variable "ret"
|
2017-02-22 10:09:32 +08:00
|
|
|
function(vcpkg_get_windows_sdk ret)
|
|
|
|
execute_process(
|
2017-03-16 07:24:45 +08:00
|
|
|
COMMAND powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "& {& '${VCPKG_ROOT_DIR}/scripts/getWindowsSDK.ps1'}" 2>&1
|
2017-07-12 05:09:56 +08:00
|
|
|
INPUT_FILE NUL
|
2017-02-22 10:09:32 +08:00
|
|
|
OUTPUT_VARIABLE WINDOWS_SDK
|
|
|
|
RESULT_VARIABLE error_code)
|
|
|
|
|
2017-03-22 06:48:29 +08:00
|
|
|
if (error_code)
|
2017-02-22 10:09:32 +08:00
|
|
|
message(FATAL_ERROR "Could not find Windows SDK")
|
|
|
|
endif()
|
|
|
|
|
2017-10-23 08:01:40 +08:00
|
|
|
# Remove trailing newline and non-numeric characters
|
|
|
|
string(REGEX REPLACE "[^0-9.]" "" WINDOWS_SDK "${WINDOWS_SDK}")
|
2017-02-22 10:09:32 +08:00
|
|
|
set(${ret} ${WINDOWS_SDK} PARENT_SCOPE)
|
|
|
|
endfunction()
|