Merge branch 'vs-win10-sdk' into release
This commit is contained in:
commit
8ce5ff8d9e
|
@ -229,6 +229,16 @@ cmGlobalVisualStudio14Generator::IsWindowsStoreToolsetInstalled() const
|
||||||
win10SDK, cmSystemTools::KeyWOW64_32);
|
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()
|
std::string cmGlobalVisualStudio14Generator::GetWindows10SDKVersion()
|
||||||
{
|
{
|
||||||
|
@ -252,6 +262,12 @@ std::string cmGlobalVisualStudio14Generator::GetWindows10SDKVersion()
|
||||||
std::string path = win10Root + "Include/*";
|
std::string path = win10Root + "Include/*";
|
||||||
// Grab the paths of the different SDKs that are installed
|
// Grab the paths of the different SDKs that are installed
|
||||||
cmSystemTools::GlobDirs(path, sdks);
|
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())
|
if (!sdks.empty())
|
||||||
{
|
{
|
||||||
// Only use the filename, which will be the SDK version.
|
// Only use the filename, which will be the SDK version.
|
||||||
|
@ -261,29 +277,21 @@ std::string cmGlobalVisualStudio14Generator::GetWindows10SDKVersion()
|
||||||
*i = cmSystemTools::GetFilenameName(*i);
|
*i = cmSystemTools::GetFilenameName(*i);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort the results to make sure we select the most recent one that
|
// Sort the results to make sure we select the most recent one.
|
||||||
// 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.
|
// Look for a SDK exactly matching the requested target version.
|
||||||
if (this->SystemVersion == "10.0")
|
for (std::vector<std::string>::iterator i = sdks.begin();
|
||||||
|
i != sdks.end(); ++i)
|
||||||
{
|
{
|
||||||
// Use the latest Windows 10 SDK since no build version was given.
|
if (cmSystemTools::VersionCompareEqual(*i, this->SystemVersion))
|
||||||
return sdks.at(0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Find the SDK less or equal to our specified version
|
|
||||||
for (std::vector<std::string>::iterator i = sdks.begin();
|
|
||||||
i != sdks.end(); ++i)
|
|
||||||
{
|
{
|
||||||
if (!cmSystemTools::VersionCompareGreater(*i, this->SystemVersion))
|
return *i;
|
||||||
{
|
|
||||||
// This is the most recent SDK that we can run safely
|
|
||||||
return *i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Use the latest Windows 10 SDK since the exact version is not available.
|
||||||
|
return sdks.at(0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// Return an empty string
|
// Return an empty string
|
||||||
|
|
|
@ -2776,6 +2776,14 @@ bool cmSystemTools::VersionCompare(cmSystemTools::CompareOp op,
|
||||||
return op == cmSystemTools::OP_EQUAL;
|
return op == cmSystemTools::OP_EQUAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool cmSystemTools::VersionCompareEqual(std::string const& lhs,
|
||||||
|
std::string const& rhs)
|
||||||
|
{
|
||||||
|
return cmSystemTools::VersionCompare(
|
||||||
|
cmSystemTools::OP_EQUAL, lhs.c_str(), rhs.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool cmSystemTools::VersionCompareGreater(std::string const& lhs,
|
bool cmSystemTools::VersionCompareGreater(std::string const& lhs,
|
||||||
std::string const& rhs)
|
std::string const& rhs)
|
||||||
|
|
|
@ -294,6 +294,8 @@ public:
|
||||||
* Compare versions
|
* Compare versions
|
||||||
*/
|
*/
|
||||||
static bool VersionCompare(CompareOp op, const char* lhs, const char* rhs);
|
static bool VersionCompare(CompareOp op, const char* lhs, const char* rhs);
|
||||||
|
static bool VersionCompareEqual(std::string const& lhs,
|
||||||
|
std::string const& rhs);
|
||||||
static bool VersionCompareGreater(std::string const& lhs,
|
static bool VersionCompareGreater(std::string const& lhs,
|
||||||
std::string const& rhs);
|
std::string const& rhs);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue