diff options
author | Brad King <brad.king@kitware.com> | 2018-09-20 13:32:30 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-09-20 13:33:05 (GMT) |
commit | f082414107fd2a77c370a8d87aa589dad0e6f55d (patch) | |
tree | a5886a44ce4711f64803e74fadddd0b551c5f12a /Source | |
parent | cf1764b395eabebcee6908f699493bf12b4b0b4b (diff) | |
parent | 63eb43f1311aedd03a4274ec4321234723f54359 (diff) | |
download | CMake-f082414107fd2a77c370a8d87aa589dad0e6f55d.zip CMake-f082414107fd2a77c370a8d87aa589dad0e6f55d.tar.gz CMake-f082414107fd2a77c370a8d87aa589dad0e6f55d.tar.bz2 |
Merge topic 'vs-2015-max-sdk'
63eb43f131 Tests: Add VSWinStorePhone for VS 15 2017
173d29a379 Tests: Fix VSWinStorePhone to properly identify VS 14 2015
83ddc4d289 VS: Do not select a Windows SDK too high for current VS version
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2388
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalVisualStudio14Generator.cxx | 26 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio14Generator.h | 4 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio15Generator.cxx | 5 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio15Generator.h | 2 |
4 files changed, 37 insertions, 0 deletions
diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index b0db146..c3ddb3e 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -212,6 +212,12 @@ bool cmGlobalVisualStudio14Generator::IsWindowsStoreToolsetInstalled() const cmSystemTools::KeyWOW64_32); } +std::string cmGlobalVisualStudio14Generator::GetWindows10SDKMaxVersion() const +{ + // The last Windows 10 SDK version that VS 2015 can target is 10.0.14393.0. + return "10.0.14393.0"; +} + #if defined(_WIN32) && !defined(__CYGWIN__) struct NoWindowsH { @@ -220,6 +226,20 @@ struct NoWindowsH return !cmSystemTools::FileExists(p + "/um/windows.h", true); } }; +class WindowsSDKTooRecent +{ + std::string const& MaxVersion; + +public: + WindowsSDKTooRecent(std::string const& maxVersion) + : MaxVersion(maxVersion) + { + } + bool operator()(std::string const& v) + { + return cmSystemTools::VersionCompareGreater(v, MaxVersion); + } +}; #endif std::string cmGlobalVisualStudio14Generator::GetWindows10SDKVersion() @@ -276,6 +296,12 @@ std::string cmGlobalVisualStudio14Generator::GetWindows10SDKVersion() // Sort the results to make sure we select the most recent one. std::sort(sdks.begin(), sdks.end(), cmSystemTools::VersionCompareGreater); + // Skip SDKs that cannot be used with our toolset. + std::string maxVersion = this->GetWindows10SDKMaxVersion(); + if (!maxVersion.empty()) { + cmEraseIf(sdks, WindowsSDKTooRecent(maxVersion)); + } + // Look for a SDK exactly matching the requested target version. for (std::string const& i : sdks) { if (cmSystemTools::VersionCompareEqual(i, this->SystemVersion)) { diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h index 4868df0..9f5bb4e 100644 --- a/Source/cmGlobalVisualStudio14Generator.h +++ b/Source/cmGlobalVisualStudio14Generator.h @@ -37,6 +37,10 @@ protected: // of the toolset is installed bool IsWindowsStoreToolsetInstalled() const; + // Used to make sure that the Windows 10 SDK selected can work with the + // version of the toolset. + virtual std::string GetWindows10SDKMaxVersion() const; + const char* GetIDEVersion() override { return "14.0"; } virtual bool SelectWindows10SDK(cmMakefile* mf, bool required); diff --git a/Source/cmGlobalVisualStudio15Generator.cxx b/Source/cmGlobalVisualStudio15Generator.cxx index 9983a43..23fd2d5 100644 --- a/Source/cmGlobalVisualStudio15Generator.cxx +++ b/Source/cmGlobalVisualStudio15Generator.cxx @@ -258,6 +258,11 @@ bool cmGlobalVisualStudio15Generator::IsWin81SDKInstalled() const return false; } +std::string cmGlobalVisualStudio15Generator::GetWindows10SDKMaxVersion() const +{ + return std::string(); +} + std::string cmGlobalVisualStudio15Generator::FindMSBuildCommand() { std::string msbuild; diff --git a/Source/cmGlobalVisualStudio15Generator.h b/Source/cmGlobalVisualStudio15Generator.h index cdc97ad..8ab63f1 100644 --- a/Source/cmGlobalVisualStudio15Generator.h +++ b/Source/cmGlobalVisualStudio15Generator.h @@ -52,6 +52,8 @@ protected: // Check for a Win 8 SDK known to the registry or VS installer tool. bool IsWin81SDKInstalled() const; + std::string GetWindows10SDKMaxVersion() const override; + std::string FindMSBuildCommand() override; std::string FindDevEnvCommand() override; |