Skip to content

Commit

Permalink
VS: Do not fail on Windows 10 with VS 2015 if no SDK is available (#1…
Browse files Browse the repository at this point in the history
…5929)

Since commit v3.4.0-rc1~5^2~1 (VS: Add support for selecting the Windows
10 SDK, 2015-09-30) the VS 2015 generator requires a Windows 10 SDK to
be available when CMAKE_SYSTEM_VERSION specifies Windows 10 (e.g.  when
building on a Windows 10 host).  Howewver, it is possible to install VS
2015 without any Windows 10 SDK.  Instead of failing with an error
message about the lack of a Windows 10 SDK, simply tolerate this case
and use the default Windows 8.1 SDK.  Since building for Windows Store
still requires the SDK, retain the diagnostic in that case.
  • Loading branch information
bradking authored and Gilles Khouzam committed Feb 4, 2016
1 parent bbcdade commit ce0fc47
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Help/variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ specification of a target Windows version to select a corresponding SDK.
The :variable:`CMAKE_SYSTEM_VERSION` variable may be set to specify a
version. Otherwise CMake computes a default version based on the Windows
SDK versions available. The chosen Windows target version number is provided
in ``CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION``.
in ``CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION``. If no Windows 10 SDK
is available this value will be empty.
9 changes: 5 additions & 4 deletions Source/cmGlobalVisualStudio14Generator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ bool cmGlobalVisualStudio14Generator::InitializeWindows(cmMakefile* mf)
{
if (cmHasLiteralPrefix(this->SystemVersion, "10.0"))
{
return this->SelectWindows10SDK(mf);
return this->SelectWindows10SDK(mf, false);
}
return true;
}
Expand Down Expand Up @@ -143,17 +143,18 @@ bool cmGlobalVisualStudio14Generator::InitializeWindowsStore(cmMakefile* mf)
}
if (cmHasLiteralPrefix(this->SystemVersion, "10.0"))
{
return this->SelectWindows10SDK(mf);
return this->SelectWindows10SDK(mf, true);
}
return true;
}

//----------------------------------------------------------------------------
bool cmGlobalVisualStudio14Generator::SelectWindows10SDK(cmMakefile* mf)
bool cmGlobalVisualStudio14Generator::SelectWindows10SDK(cmMakefile* mf,
bool required)
{
// Find the default version of the Windows 10 SDK.
this->WindowsTargetPlatformVersion = this->GetWindows10SDKVersion();
if (this->WindowsTargetPlatformVersion.empty())
if (required && this->WindowsTargetPlatformVersion.empty())
{
std::ostringstream e;
e << "Could not find an appropriate version of the Windows 10 SDK"
Expand Down
2 changes: 1 addition & 1 deletion Source/cmGlobalVisualStudio14Generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class cmGlobalVisualStudio14Generator:
bool IsWindowsStoreToolsetInstalled() const;

virtual const char* GetIDEVersion() { return "14.0"; }
virtual bool SelectWindows10SDK(cmMakefile* mf);
virtual bool SelectWindows10SDK(cmMakefile* mf, bool required);

// Used to verify that the Desktop toolset for the current generator is
// installed on the machine.
Expand Down

0 comments on commit ce0fc47

Please sign in to comment.