Find WindowsSDK library (SetupApi)

Is there an official way to ensure that the active Windows SDK library path is searched by find_library()? I can find via Google various 3rdparty CMake files, but hoped there might be a recommend best practice?

Eg on my system, the SDK is at C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\um\x64 - but this obviously depends on architecture, and when a new SDK is released the path will change. The scripts I’ve found lookup a registry key to find the active path, but I was hoping the VisualStudio environment / compiler would already have the path added?

No it won’t. In VS of recent years, the targeted SDK is a property of the VS project file. You can’t have a SDK “change out from under you” like in the old days.

Ah, good to know. I actually managed to skip around this problem, but still useful to understand a bit more.