aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2017-02-21 18:09:32 -0800
committerAlexander Karatarakis <alkarata@microsoft.com>2017-02-21 18:09:32 -0800
commitc44c085e8ba5b3129126a9765132c1d756323c52 (patch)
tree00eb5256f3aa0100d7e1030d375e99752917827b /scripts
parenta2cebceafec8341fcab0236a3c81a27f935aeb38 (diff)
downloadvcpkg-c44c085e8ba5b3129126a9765132c1d756323c52.tar.gz
vcpkg-c44c085e8ba5b3129126a9765132c1d756323c52.zip
Add vcpkg_get_windows_sdk.cmake
Diffstat (limited to 'scripts')
-rw-r--r--scripts/cmake/vcpkg_common_functions.cmake1
-rw-r--r--scripts/cmake/vcpkg_get_windows_sdk.cmake15
2 files changed, 16 insertions, 0 deletions
diff --git a/scripts/cmake/vcpkg_common_functions.cmake b/scripts/cmake/vcpkg_common_functions.cmake
index 50c4ed2dc..44278ebba 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 000000000..6dde6f0c7
--- /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