Add vcpkg_get_windows_sdk.cmake

This commit is contained in:
Alexander Karatarakis 2017-02-21 18:09:32 -08:00
parent a2cebceafe
commit c44c085e8b
2 changed files with 16 additions and 0 deletions

View File

@ -16,3 +16,4 @@ include(vcpkg_copy_pdbs)
include(vcpkg_copy_tool_dependencies)
include(vcpkg_get_program_files_32_bit)
include(vcpkg_get_program_files_platform_bitness)
include(vcpkg_get_windows_sdk)

View File

@ -0,0 +1,15 @@
function(vcpkg_get_windows_sdk ret)
execute_process(
COMMAND powershell.exe ${VCPKG_ROOT_DIR}/scripts/getWindowsSDK.ps1
OUTPUT_VARIABLE WINDOWS_SDK
RESULT_VARIABLE error_code)
if (${error_code})
message(FATAL_ERROR "Could not find Windows SDK")
endif()
# Remove trailing newline
string(REGEX REPLACE "\n$" "" WINDOWS_SDK "${WINDOWS_SDK}")
set(${ret} ${WINDOWS_SDK} PARENT_SCOPE)
endfunction()