From c44c085e8ba5b3129126a9765132c1d756323c52 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 21 Feb 2017 18:09:32 -0800 Subject: [PATCH] Add vcpkg_get_windows_sdk.cmake --- scripts/cmake/vcpkg_common_functions.cmake | 1 + scripts/cmake/vcpkg_get_windows_sdk.cmake | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 scripts/cmake/vcpkg_get_windows_sdk.cmake diff --git a/scripts/cmake/vcpkg_common_functions.cmake b/scripts/cmake/vcpkg_common_functions.cmake index 50c4ed2dcb1..44278ebba92 100644 --- a/scripts/cmake/vcpkg_common_functions.cmake +++ b/scripts/cmake/vcpkg_common_functions.cmake @@ -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) diff --git a/scripts/cmake/vcpkg_get_windows_sdk.cmake b/scripts/cmake/vcpkg_get_windows_sdk.cmake new file mode 100644 index 00000000000..6dde6f0c76c --- /dev/null +++ b/scripts/cmake/vcpkg_get_windows_sdk.cmake @@ -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() \ No newline at end of file