diff options
author | Gilles Khouzam <gillesk@microsoft.com> | 2015-10-02 18:34:55 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-10-02 20:34:11 (GMT) |
commit | d1b87d72f964ae57966c5f02ee9e32236bd59338 (patch) | |
tree | 6d303a93c4cad7f8f41ce9f6ea6681666c3efe90 | |
parent | 458121116a05665ebc0cf6a066977c00b8e55e5c (diff) | |
download | CMake-d1b87d72f964ae57966c5f02ee9e32236bd59338.zip CMake-d1b87d72f964ae57966c5f02ee9e32236bd59338.tar.gz CMake-d1b87d72f964ae57966c5f02ee9e32236bd59338.tar.bz2 |
VS: Select Windows 10 Store SDK and toolset for VS 2015
-rw-r--r-- | Source/cmGlobalVisualStudio14Generator.cxx | 63 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio14Generator.h | 7 |
2 files changed, 70 insertions, 0 deletions
diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index 661dddd..41825fb 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 fcade85..76c15d9 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); |