From c173e37fa32b9d212cc6305f5e6dc881ba34e140 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 7 Jan 2016 14:54:32 -0500 Subject: [PATCH] VS: Do not select a partial Windows 10 SDK folder (#15831) Skip SDK candidate folders that do not contain as they are not full SDKs. --- Source/cmGlobalVisualStudio14Generator.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index 41825fb15..803b50083 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -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 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.