mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-19 02:17:27 +08:00
VS: Factor out a method to set the Windows SDK version internally
This commit is contained in:
@@ -158,14 +158,22 @@ bool cmGlobalVisualStudio14Generator::SelectWindows10SDK(cmMakefile* mf,
|
|||||||
bool required)
|
bool required)
|
||||||
{
|
{
|
||||||
// Find the default version of the Windows 10 SDK.
|
// Find the default version of the Windows 10 SDK.
|
||||||
this->WindowsTargetPlatformVersion = this->GetWindows10SDKVersion();
|
std::string const version = this->GetWindows10SDKVersion();
|
||||||
if (required && this->WindowsTargetPlatformVersion.empty()) {
|
if (required && version.empty()) {
|
||||||
std::ostringstream e;
|
std::ostringstream e;
|
||||||
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";
|
<< " installed on this machine";
|
||||||
mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
|
mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
this->SetWindowsTargetPlatformVersion(version, mf);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmGlobalVisualStudio14Generator::SetWindowsTargetPlatformVersion(
|
||||||
|
std::string const& version, cmMakefile* mf)
|
||||||
|
{
|
||||||
|
this->WindowsTargetPlatformVersion = version;
|
||||||
if (!cmSystemTools::VersionCompareEqual(this->WindowsTargetPlatformVersion,
|
if (!cmSystemTools::VersionCompareEqual(this->WindowsTargetPlatformVersion,
|
||||||
this->SystemVersion)) {
|
this->SystemVersion)) {
|
||||||
std::ostringstream e;
|
std::ostringstream e;
|
||||||
@@ -175,7 +183,6 @@ bool cmGlobalVisualStudio14Generator::SelectWindows10SDK(cmMakefile* mf,
|
|||||||
}
|
}
|
||||||
mf->AddDefinition("CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION",
|
mf->AddDefinition("CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION",
|
||||||
this->WindowsTargetPlatformVersion.c_str());
|
this->WindowsTargetPlatformVersion.c_str());
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmGlobalVisualStudio14Generator::SelectWindowsStoreToolset(
|
bool cmGlobalVisualStudio14Generator::SelectWindowsStoreToolset(
|
||||||
|
@@ -40,6 +40,9 @@ protected:
|
|||||||
|
|
||||||
virtual bool SelectWindows10SDK(cmMakefile* mf, bool required);
|
virtual bool SelectWindows10SDK(cmMakefile* mf, bool required);
|
||||||
|
|
||||||
|
void SetWindowsTargetPlatformVersion(std::string const& version,
|
||||||
|
cmMakefile* mf);
|
||||||
|
|
||||||
// Used to verify that the Desktop toolset for the current generator is
|
// Used to verify that the Desktop toolset for the current generator is
|
||||||
// installed on the machine.
|
// installed on the machine.
|
||||||
bool IsWindowsDesktopToolsetInstalled() const override;
|
bool IsWindowsDesktopToolsetInstalled() const override;
|
||||||
|
Reference in New Issue
Block a user