aboutsummaryrefslogtreecommitdiff
path: root/scripts/cmake/vcpkg_get_windows_sdk.cmake
blob: 64d8838e7a3672c3f3c7c699f671027743605fff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 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
        INPUT_FILE NUL
        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()