VS: Select latest Windows 10 SDK if no specific version was requested

If CMAKE_SYSTEM_VERSION is just "10.0" then use the latest SDK available
since no particular version was requested.
This commit is contained in:
Gilles Khouzam 2015-10-02 11:34:55 -07:00 committed by Brad King
parent 3f077996f5
commit 458121116a
1 changed files with 14 additions and 5 deletions

View File

@ -202,10 +202,18 @@ std::string cmGlobalVisualStudio14Generator::GetWindows10SDKVersion()
// has a version less or equal to our version of the operating system // has a version less or equal to our version of the operating system
std::sort(sdks.begin(), sdks.end(), cmSystemTools::VersionCompareGreater); std::sort(sdks.begin(), sdks.end(), cmSystemTools::VersionCompareGreater);
// Select a suitable SDK version.
if (this->SystemVersion == "10.0")
{
// Use the latest Windows 10 SDK since no build version was given.
return sdks.at(0);
}
else
{
// Find the SDK less or equal to our specified version
for (std::vector<std::string>::iterator i = sdks.begin(); for (std::vector<std::string>::iterator i = sdks.begin();
i != sdks.end(); ++i) i != sdks.end(); ++i)
{ {
// Find the SDK less or equal to our specified version
if (!cmSystemTools::VersionCompareGreater(*i, this->SystemVersion)) if (!cmSystemTools::VersionCompareGreater(*i, this->SystemVersion))
{ {
// This is the most recent SDK that we can run safely // This is the most recent SDK that we can run safely
@ -213,6 +221,7 @@ std::string cmGlobalVisualStudio14Generator::GetWindows10SDKVersion()
} }
} }
} }
}
#endif #endif
// Return an empty string // Return an empty string
return std::string(); return std::string();