VS: Find Desktop SDK for current VS version (#15662)

Determine the Desktop SDK for Windows Phone and Windows Store from the
generator instead of the version of the targeted app.  This allows to
build a Windows Phone 8.1 app on VS 2015 for example.
This commit is contained in:
Gilles Khouzam 2015-09-01 13:52:36 -07:00 committed by Brad King
parent 72c11e5902
commit 4b8b91688f
4 changed files with 26 additions and 2 deletions

View File

@ -34,9 +34,12 @@ protected:
virtual bool SelectWindowsPhoneToolset(std::string& toolset) const;
virtual bool SelectWindowsStoreToolset(std::string& toolset) const;
// Used to verify that the Desktop toolset for the current generator is
// installed on the machine.
virtual bool IsWindowsDesktopToolsetInstalled() const;
// These aren't virtual because we need to check if the selected version
// of the toolset is installed
bool IsWindowsDesktopToolsetInstalled() const;
bool IsWindowsPhoneToolsetInstalled() const;
bool IsWindowsStoreToolsetInstalled() const;

View File

@ -38,9 +38,12 @@ protected:
virtual bool SelectWindowsPhoneToolset(std::string& toolset) const;
virtual bool SelectWindowsStoreToolset(std::string& toolset) const;
// Used to verify that the Desktop toolset for the current generator is
// installed on the machine.
virtual bool IsWindowsDesktopToolsetInstalled() const;
// These aren't virtual because we need to check if the selected version
// of the toolset is installed
bool IsWindowsDesktopToolsetInstalled() const;
bool IsWindowsPhoneToolsetInstalled() const;
bool IsWindowsStoreToolsetInstalled() const;
virtual const char* GetIDEVersion() { return "12.0"; }

View File

@ -124,3 +124,16 @@ void cmGlobalVisualStudio14Generator::WriteSLNHeader(std::ostream& fout)
fout << "# Visual Studio 14\n";
}
}
//----------------------------------------------------------------------------
bool
cmGlobalVisualStudio14Generator::IsWindowsDesktopToolsetInstalled() const
{
const char desktop10Key[] =
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
"VisualStudio\\14.0\\VC\\Runtimes";
std::vector<std::string> vc14;
return cmSystemTools::GetRegistrySubKeys(desktop10Key,
vc14, cmSystemTools::KeyWOW64_32);
}

View File

@ -31,6 +31,11 @@ public:
virtual const char* GetToolsVersion() { return "14.0"; }
protected:
virtual const char* GetIDEVersion() { return "14.0"; }
// Used to verify that the Desktop toolset for the current generator is
// installed on the machine.
virtual bool IsWindowsDesktopToolsetInstalled() const;
private:
class Factory;
};