Hello,
I want to build my project against the Windows SDK 8.1.
I have no idea how to configure cmake to use it?
Can someone help me?
I think you need to set the target platform as the appropriate version. I don’t remember how to do that off-hand though and the docs don’t show anything with a quick search.
I don’t know if this is a viable solution, but in our CI script we have:
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" 10.0.22621.0
To build against specific version of the SDK. If I remember correctly to pick 8.1 SDK, you have to pass 8
as the argument instead.
For Visual Studio generator, set CMAKE_SYSTEM_VERSION to e.g. 7
Bitte that you have to install this SDK separately, it is not part of VS installer anymore.
The docs for CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION might give a clue. As @hsattler mentioned, it seems like you need to set CMAKE_SYSTEM_VERSION
, but I’m not sure exactly what values map to what SDK versions.
I have solved it. I set the environment “CMAKE_SYSTEM_VERSION”=“8.1”
in the CMakeSettings.json.
Now CMake use the Windows SDK 8.1A
“The CMAKE_SYSTEM_VERSION
should be set on the command line on the first configuration of a new build tree (cmake-gui has options to add it as a cache entry before configuring). It is part of defining the target platform, and should remain constant once a build tree is first configured. Alternatively, it can be set in a toolchain file during cross-compiling, but I don’t thi
nk that is relevant to your use case.”
Thanks to Brad King
posted here :