VS: Do not select a partial Windows 10 SDK folder (#15831)

Skip SDK candidate folders that do not contain <um/windows.h> as they
are not full SDKs.
This commit is contained in:
Brad King 2016-01-07 14:54:32 -05:00
parent fd7180f0c0
commit c173e37fa3
1 changed files with 16 additions and 0 deletions

View File

@ -229,6 +229,16 @@ cmGlobalVisualStudio14Generator::IsWindowsStoreToolsetInstalled() const
win10SDK, cmSystemTools::KeyWOW64_32);
}
#if defined(_WIN32) && !defined(__CYGWIN__)
struct NoWindowsH
{
bool operator()(std::string const& p)
{
return !cmSystemTools::FileExists(p + "/um/windows.h", true);
}
};
#endif
//----------------------------------------------------------------------------
std::string cmGlobalVisualStudio14Generator::GetWindows10SDKVersion()
{
@ -252,6 +262,12 @@ std::string cmGlobalVisualStudio14Generator::GetWindows10SDKVersion()
std::string path = win10Root + "Include/*";
// Grab the paths of the different SDKs that are installed
cmSystemTools::GlobDirs(path, sdks);
// Skip SDKs that do not contain <um/windows.h> because that indicates that
// only the UCRT MSIs were installed for them.
sdks.erase(std::remove_if(sdks.begin(), sdks.end(), NoWindowsH()),
sdks.end());
if (!sdks.empty())
{
// Only use the filename, which will be the SDK version.