I’m running Windows 10 Home 1903 (OS Build 18362.46).
My C:\Program Files (x86)\Windows Kits\10\Lib folder contains:
10.0.16299.0
10.0.17134.0
10.0.17763.0
No matter what I do, CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION, returns 10.0.16299.0.
Surely, it should pick the highest version? What is the expected behaviour for this?
How is it supposed to work? This has been driving me nuts for a long time and only now have I realised I should be posting this here ^^
This variable reports what Windows SDK is being targeted by the current build. Setting this variable has no effect, instead what you need to do is specify an explicit CMAKE_SYSTEM_VERSION when configuring a project for the first time.
I believe the reason that 10.0.16299.0 is being selected is that you might only have the runtime files for the other SDK’s and not the development headers.
Thanks for the suggestions.
I checked and I have a whole bunch of headers under C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0 etc.
What are valid settings for CMAKE_SYSTEM_VERSION?
Something like SET( CMAKE_HOST_SYSTEM_VERSION 10.0.17763.0) ?
(I can’t check right now as I’m away from my dev PC)
CMAKE_HOST_SYSTEM_VERSION is always computed automatically from the real host version.
A toolchain file can
set(CMAKE_SYSTEM_VERSION 10.0)
The value 10.0 tells CMake to look for the largest available Windows SDK version. Or one can use any four-component version corresponding to a directory like C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0, e.g.
set(CMAKE_SYSTEM_VERSION 10.0.17763.0)
If building for a Windows target and the only thing you want to do is select the SDK version, you don’t need a toolchain file and can just define CMAKE_SYSTEM_VERSION on the command line, e.g.