-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CMakeLists.txt: Check the Windows SDK version #2729
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK I can't think of a better way to do this, I don't like the compiler checks though, as they are slow.
Regarding slowness, I measured the cost with: "C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Auxiliary\Build\vcvars64.bat"
pushd C:\GitHub\STL
git clean -x -d -f
pwsh Measure-Command { cmake -G Ninja -S . -B out\build\x64 | Out-Default } I compared
Thus this costs ~145 ms on my i7-10700. |
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
Toolset update #2714 began requiring the Windows 11 SDK 22000 to build and test the STL. Although it's mentioned in the README, if a contributor misses this dependency, the resulting error message is incomprehensible (as @miscco discovered). @strega-nil-ms suggested adding a build check.
Fortunately, the Windows SDK provides a macro to identify itself,
WDK_NTDDI_VERSION
. (UnlikeNTDDI_VERSION
, this is not subject to user overrides.) It's present in the default WinSDK, where it was set to "Vibranium", whereas in the latest WinSDK, it's set to "Cobalt":C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\sdkddkver.h
#define WDK_NTDDI_VERSION NTDDI_WIN10_VB /* ABRACADABRA_WIN10_VB */
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\shared\sdkddkver.h
#define WDK_NTDDI_VERSION NTDDI_WIN10_CO
I've tested this by changing my installed WinSDK. Here's the user experience:
❌ Windows 10 SDK 19041, failure:
✅ Windows 11 SDK 22000, success: