Skip to content

Commit

Permalink
Fix Windows version detection on Windows 10 + VS 2015
Browse files Browse the repository at this point in the history
  • Loading branch information
infosia committed Oct 1, 2015
1 parent 280597b commit 2919f82
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions Source/cmGlobalVisualStudio14Generator.cxx
Expand Up @@ -142,7 +142,7 @@ bool cmGlobalVisualStudio14Generator::InitializeWindowsStore(cmMakefile* mf)
std::string sdkVersion = GetWindows10SDKVersion();
if(sdkVersion.empty())
{
e << "Could not find an appropriate version of the Windows 10 SDK"
e << "Could not find an appropriate version of the Windows 10 SDK "
<< "installed on this machine";
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
return false;
Expand Down Expand Up @@ -267,9 +267,18 @@ std::string cmGlobalVisualStudio14Generator::GetWindows10SDKVersion()
osviex.dwMajorVersion = atoi(tokens[0].c_str());
osviex.dwMinorVersion = atoi(tokens[1].c_str());
osviex.dwBuildNumber = atoi(tokens[2].c_str());
if (VerifyVersionInfo(&osviex,
VER_MAJORVERSION | VER_MINORVERSION | VER_BUILDNUMBER,
dwlConditionMask))
auto verified = VerifyVersionInfo(&osviex,
VER_MAJORVERSION | VER_MINORVERSION /* | VER_BUILDNUMBER */,
dwlConditionMask);
// VerifyVersionInfo could accept 10 or 6 for major version on Windows 10
if (!verified && osviex.dwMajorVersion == 10) {
osviex.dwMajorVersion = 6;
verified = VerifyVersionInfo(&osviex,
VER_MAJORVERSION | VER_MINORVERSION /* | VER_BUILDNUMBER */,
dwlConditionMask);
}

if (verified)
{
// This is the most recent SDK that we can run safely
return sdkVersion;
Expand Down

0 comments on commit 2919f82

Please sign in to comment.