diff options
author | Brad King <brad.king@kitware.com> | 2023-03-31 17:21:29 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-04-05 16:06:22 (GMT) |
commit | e259063b0a52768dfb1960401b363437e30baf40 (patch) | |
tree | 70add28ea03d238c33d08c6ffbcf4d18546594ea /Source | |
parent | 8499374c6a7114d83a8768edd611caf02d9941a1 (diff) | |
download | CMake-e259063b0a52768dfb1960401b363437e30baf40.zip CMake-e259063b0a52768dfb1960401b363437e30baf40.tar.gz CMake-e259063b0a52768dfb1960401b363437e30baf40.tar.bz2 |
VS: Defer Windows SDK selection until CMAKE_GENERATOR_PLATFORM is known
Prepare to teach `CMAKE_GENERATOR_PLATFORM` to affect SDK selection.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalVisualStudio10Generator.cxx | 15 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio10Generator.h | 3 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio14Generator.cxx | 5 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio14Generator.h | 3 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio8Generator.cxx | 9 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio8Generator.h | 2 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudioVersionedGenerator.cxx | 5 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudioVersionedGenerator.h | 3 |
8 files changed, 37 insertions, 8 deletions
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 1e01dd6..41d54e5 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -525,6 +525,21 @@ bool cmGlobalVisualStudio10Generator::InitializeAndroid(cmMakefile* mf) return false; } +bool cmGlobalVisualStudio10Generator::InitializePlatform(cmMakefile* mf) +{ + if (this->SystemName == "Windows" || this->SystemName == "WindowsStore") { + if (!this->InitializePlatformWindows(mf)) { + return false; + } + } + return this->cmGlobalVisualStudio8Generator::InitializePlatform(mf); +} + +bool cmGlobalVisualStudio10Generator::InitializePlatformWindows(cmMakefile*) +{ + return true; +} + bool cmGlobalVisualStudio10Generator::SelectWindowsPhoneToolset( std::string& toolset) const { diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index deed206..63cfe72 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -183,6 +183,9 @@ protected: virtual bool InitializeTegraAndroid(cmMakefile* mf); virtual bool InitializeAndroid(cmMakefile* mf); + bool InitializePlatform(cmMakefile* mf) override; + virtual bool InitializePlatformWindows(cmMakefile* mf); + virtual bool ProcessGeneratorToolsetField(std::string const& key, std::string const& value); diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index 4b59b16..87c8a5e 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -137,7 +137,7 @@ bool cmGlobalVisualStudio14Generator::MatchesGeneratorName( return false; } -bool cmGlobalVisualStudio14Generator::InitializeWindows(cmMakefile* mf) +bool cmGlobalVisualStudio14Generator::InitializePlatformWindows(cmMakefile* mf) { if (cmHasLiteralPrefix(this->SystemVersion, "10.0")) { return this->SelectWindows10SDK(mf); @@ -162,9 +162,6 @@ bool cmGlobalVisualStudio14Generator::InitializeWindowsStore(cmMakefile* mf) mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } - if (cmHasLiteralPrefix(this->SystemVersion, "10.0")) { - return this->SelectWindows10SDK(mf); - } return true; } diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h index 30e8b18..0f016b3 100644 --- a/Source/cmGlobalVisualStudio14Generator.h +++ b/Source/cmGlobalVisualStudio14Generator.h @@ -30,7 +30,6 @@ protected: cmGlobalVisualStudio14Generator(cmake* cm, const std::string& name, std::string const& platformInGeneratorName); - bool InitializeWindows(cmMakefile* mf) override; bool InitializeWindowsStore(cmMakefile* mf) override; bool InitializeAndroid(cmMakefile* mf) override; bool SelectWindowsStoreToolset(std::string& toolset) const override; @@ -39,6 +38,8 @@ protected: // of the toolset is installed bool IsWindowsStoreToolsetInstalled() const; + bool InitializePlatformWindows(cmMakefile* mf) override; + // Used to adjust the max-SDK-version calculation to accommodate user // configuration. std::string GetWindows10SDKMaxVersion(cmMakefile* mf) const; diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 2e2c8b6..c33a3c9 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -114,12 +114,21 @@ bool cmGlobalVisualStudio8Generator::SetGeneratorPlatform(std::string const& p, *targetFrameworkTargetsVersion); } + if (!this->InitializePlatform(mf)) { + return false; + } + // The generator name does not contain the platform name, and so supports // explicit platform specification. We handled that above, so pass an // empty platform name to our base class implementation so it does not error. return this->cmGlobalVisualStudio7Generator::SetGeneratorPlatform("", mf); } +bool cmGlobalVisualStudio8Generator::InitializePlatform(cmMakefile*) +{ + return true; +} + cm::optional<std::string> const& cmGlobalVisualStudio8Generator::GetTargetFrameworkVersion() const { diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index fe57c54..34e9fab 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -60,6 +60,8 @@ protected: cmGlobalVisualStudio8Generator(cmake* cm, const std::string& name, std::string const& platformInGeneratorName); + virtual bool InitializePlatform(cmMakefile* mf); + void AddExtraIDETargets() override; std::string FindDevEnvCommand() override; diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index f4a4d3d..f3936ce 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -885,7 +885,8 @@ cmGlobalVisualStudioVersionedGenerator::FindAuxToolset( return AuxToolset::PropsMissing; } -bool cmGlobalVisualStudioVersionedGenerator::InitializeWindows(cmMakefile* mf) +bool cmGlobalVisualStudioVersionedGenerator::InitializePlatformWindows( + cmMakefile* mf) { // If the Win 8.1 SDK is installed then we can select a SDK matching // the target Windows version. @@ -896,7 +897,7 @@ bool cmGlobalVisualStudioVersionedGenerator::InitializeWindows(cmMakefile* mf) this->SetWindowsTargetPlatformVersion("8.1", mf); return true; } - return cmGlobalVisualStudio14Generator::InitializeWindows(mf); + return cmGlobalVisualStudio14Generator::InitializePlatformWindows(mf); } // Otherwise we must choose a Win 10 SDK even if we are not targeting // Windows 10. diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.h b/Source/cmGlobalVisualStudioVersionedGenerator.h index 45aca74..fb4b1d7 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.h +++ b/Source/cmGlobalVisualStudioVersionedGenerator.h @@ -61,7 +61,6 @@ protected: VSVersion version, cmake* cm, const std::string& name, std::string const& platformInGeneratorName); - bool InitializeWindows(cmMakefile* mf) override; bool SelectWindowsStoreToolset(std::string& toolset) const override; // Used to verify that the Desktop toolset for the current generator is @@ -72,6 +71,8 @@ protected: // of the toolset is installed bool IsWindowsStoreToolsetInstalled() const; + bool InitializePlatformWindows(cmMakefile* mf) override; + // Check for a Win 8 SDK known to the registry or VS installer tool. bool IsWin81SDKInstalled() const; |