summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-03-31 13:21:29 -0400
committerBrad King <brad.king@kitware.com>2023-04-05 12:06:22 -0400
commite259063b0a52768dfb1960401b363437e30baf40 (patch)
tree70add28ea03d238c33d08c6ffbcf4d18546594ea /Source
parent8499374c6a7114d83a8768edd611caf02d9941a1 (diff)
downloadcmake-e259063b0a52768dfb1960401b363437e30baf40.tar.gz
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.cxx15
-rw-r--r--Source/cmGlobalVisualStudio10Generator.h3
-rw-r--r--Source/cmGlobalVisualStudio14Generator.cxx5
-rw-r--r--Source/cmGlobalVisualStudio14Generator.h3
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx9
-rw-r--r--Source/cmGlobalVisualStudio8Generator.h2
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.cxx5
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.h3
8 files changed, 37 insertions, 8 deletions
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 1e01dd6a2b..41d54e51ad 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 deed206c13..63cfe721ec 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 4b59b1671c..87c8a5ed65 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 30e8b185a9..0f016b35de 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 2e2c8b686d..c33a3c9ffe 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 fe57c545fd..34e9fab591 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 f4a4d3dccf..f3936ce133 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 45aca74a80..fb4b1d7934 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;