Commit f33fed6f authored by Piyush Aggarwal's avatar Piyush Aggarwal 🎮
Browse files

windows: fix support for WIN_SDK < 19041

inspired by : https://gitlab.kitware.com/cmake/cmake/-/blob/v3.17.3/Modules/InstallRequiredSystemLibraries.cmake#L339-358
Since CMake doesn't really has a way of providing the Win10 SDK's version ( see: https://gitlab.kitware.com/cmake/cmake/-/issues/20773 )
we read the XML file set up by the SDK and filter the SDK version out of it
parent c0cbcc0d
Pipeline #66106 passed with stage
in 4 minutes and 6 seconds
......@@ -101,7 +101,11 @@ if (KF5_OPTIONAL_COMPONENTS)
endif()
if (WIN32)
string(REGEX MATCH "[0-9][0-9][0-9][0-9][0-9]" WIN_SDK_VERSION "${CMAKE_SYSTEM_VERSION}" )
get_filename_component(WINDOWS_KITS_DIR
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]" ABSOLUTE)
file(READ "${WINDOWS_KITS_DIR}/SDKManifest.xml" SDK_MANIFEST)
string(REGEX MATCH "PlatformIdentity[^\n]*" PLATFORM_IDENTITY "${SDK_MANIFEST}" )
string(REGEX MATCH "[0-9][0-9][0-9][0-9][0-9]" WIN_SDK_VERSION "${PLATFORM_IDENTITY}" )
add_compile_definitions(WIN_SDK_VERSION=${WIN_SDK_VERSION})
endif()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment