summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Khouzam <gillesk@microsoft.com>2015-10-02 11:34:55 -0700
committerBrad King <brad.king@kitware.com>2015-10-02 16:34:11 -0400
commitd1b87d72f964ae57966c5f02ee9e32236bd59338 (patch)
tree6d303a93c4cad7f8f41ce9f6ea6681666c3efe90
parent458121116a05665ebc0cf6a066977c00b8e55e5c (diff)
downloadcmake-d1b87d72f964ae57966c5f02ee9e32236bd59338.tar.gz
VS: Select Windows 10 Store SDK and toolset for VS 2015
-rw-r--r--Source/cmGlobalVisualStudio14Generator.cxx63
-rw-r--r--Source/cmGlobalVisualStudio14Generator.h7
2 files changed, 70 insertions, 0 deletions
diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx
index 661dddd880..41825fb150 100644
--- a/Source/cmGlobalVisualStudio14Generator.cxx
+++ b/Source/cmGlobalVisualStudio14Generator.cxx
@@ -121,6 +121,34 @@ bool cmGlobalVisualStudio14Generator::InitializeWindows(cmMakefile* mf)
}
//----------------------------------------------------------------------------
+bool cmGlobalVisualStudio14Generator::InitializeWindowsStore(cmMakefile* mf)
+{
+ std::ostringstream e;
+ if(!this->SelectWindowsStoreToolset(this->DefaultPlatformToolset))
+ {
+ if(this->DefaultPlatformToolset.empty())
+ {
+ e << this->GetName() << " supports Windows Store '8.0', '8.1' and "
+ "'10.0', but not '" << this->SystemVersion <<
+ "'. Check CMAKE_SYSTEM_VERSION.";
+ }
+ else
+ {
+ e << "A Windows Store component with CMake requires both the Windows "
+ << "Desktop SDK as well as the Windows Store '" << this->SystemVersion
+ << "' SDK. Please make sure that you have both installed";
+ }
+ mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+ return false;
+ }
+ if (cmHasLiteralPrefix(this->SystemVersion, "10.0"))
+ {
+ return this->SelectWindows10SDK(mf);
+ }
+ return true;
+}
+
+//----------------------------------------------------------------------------
bool cmGlobalVisualStudio14Generator::SelectWindows10SDK(cmMakefile* mf)
{
// Find the default version of the Windows 10 SDK.
@@ -139,6 +167,28 @@ bool cmGlobalVisualStudio14Generator::SelectWindows10SDK(cmMakefile* mf)
}
//----------------------------------------------------------------------------
+bool
+cmGlobalVisualStudio14Generator::SelectWindowsStoreToolset(
+ std::string& toolset) const
+{
+ if (cmHasLiteralPrefix(this->SystemVersion, "10.0"))
+ {
+ if (this->IsWindowsStoreToolsetInstalled() &&
+ this->IsWindowsDesktopToolsetInstalled())
+ {
+ toolset = "v140";
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ return
+ this->cmGlobalVisualStudio12Generator::SelectWindowsStoreToolset(toolset);
+}
+
+//----------------------------------------------------------------------------
void cmGlobalVisualStudio14Generator::WriteSLNHeader(std::ostream& fout)
{
// Visual Studio 14 writes .sln format 12.00
@@ -167,6 +217,19 @@ cmGlobalVisualStudio14Generator::IsWindowsDesktopToolsetInstalled() const
}
//----------------------------------------------------------------------------
+bool
+cmGlobalVisualStudio14Generator::IsWindowsStoreToolsetInstalled() const
+{
+ const char universal10Key[] =
+ "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
+ "VisualStudio\\14.0\\Setup\\Build Tools for Windows 10;SrcPath";
+
+ std::string win10SDK;
+ return cmSystemTools::ReadRegistryValue(universal10Key,
+ win10SDK, cmSystemTools::KeyWOW64_32);
+}
+
+//----------------------------------------------------------------------------
std::string cmGlobalVisualStudio14Generator::GetWindows10SDKVersion()
{
#if defined(_WIN32) && !defined(__CYGWIN__)
diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h
index fcade852c6..76c15d99c2 100644
--- a/Source/cmGlobalVisualStudio14Generator.h
+++ b/Source/cmGlobalVisualStudio14Generator.h
@@ -31,6 +31,13 @@ public:
virtual const char* GetToolsVersion() { return "14.0"; }
protected:
virtual bool InitializeWindows(cmMakefile* mf);
+ virtual bool InitializeWindowsStore(cmMakefile* mf);
+ virtual bool SelectWindowsStoreToolset(std::string& toolset) const;
+
+ // These aren't virtual because we need to check if the selected version
+ // of the toolset is installed
+ bool IsWindowsStoreToolsetInstalled() const;
+
virtual const char* GetIDEVersion() { return "14.0"; }
virtual bool SelectWindows10SDK(cmMakefile* mf);