summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalVisualStudio8Generator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-11-08 17:38:28 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-11-08 17:38:47 (GMT)
commit2b9b64269f8b9d16a04a098144a3557ce9ee8aae (patch)
tree42e602b34c17d003fcb52c027493b915f808c586 /Source/cmGlobalVisualStudio8Generator.cxx
parent5f215253a88b34f9f9b04aa8371842ec88504f35 (diff)
parentd51246c6621aa5025e06fcea720930ae00e6f448 (diff)
downloadCMake-2b9b64269f8b9d16a04a098144a3557ce9ee8aae.zip
CMake-2b9b64269f8b9d16a04a098144a3557ce9ee8aae.tar.gz
CMake-2b9b64269f8b9d16a04a098144a3557ce9ee8aae.tar.bz2
Merge topic 'vs-framework-version' into release-3.22
d51246c662 VS: Default TargetFrameworkVersion to v4.7.2 for VS 2022 f97f8537f3 VS: Model a default target framework e40cedddc0 cmVisualStudio10TargetGenerator: Refactor target framework selection 78782cc7dc cmGlobalVisualStudio8Generator: Refactor SetGeneratorPlatform Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6699
Diffstat (limited to 'Source/cmGlobalVisualStudio8Generator.cxx')
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx51
1 files changed, 47 insertions, 4 deletions
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 092e5b9..1e45813 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -67,12 +67,55 @@ void cmGlobalVisualStudio8Generator::AddPlatformDefinitions(cmMakefile* mf)
bool cmGlobalVisualStudio8Generator::SetGeneratorPlatform(std::string const& p,
cmMakefile* mf)
{
- if (!this->PlatformInGeneratorName) {
- this->GeneratorPlatform = p;
- return this->cmGlobalVisualStudio7Generator::SetGeneratorPlatform("", mf);
- } else {
+ if (this->PlatformInGeneratorName) {
+ // This is an old-style generator name that contains the platform name.
+ // No explicit platform specification is supported, so pass it through
+ // to our base class implementation, which errors on non-empty platforms.
return this->cmGlobalVisualStudio7Generator::SetGeneratorPlatform(p, mf);
}
+
+ this->GeneratorPlatform = p;
+
+ // FIXME: Add CMAKE_GENERATOR_PLATFORM field to set the framework.
+ // For now, just report the generator's default, if any.
+ if (cm::optional<std::string> const& targetFrameworkVersion =
+ this->GetTargetFrameworkVersion()) {
+ mf->AddDefinition("CMAKE_VS_TARGET_FRAMEWORK_VERSION",
+ *targetFrameworkVersion);
+ }
+ if (cm::optional<std::string> const& targetFrameworkIdentifier =
+ this->GetTargetFrameworkIdentifier()) {
+ mf->AddDefinition("CMAKE_VS_TARGET_FRAMEWORK_IDENTIFIER",
+ *targetFrameworkIdentifier);
+ }
+ if (cm::optional<std::string> const& targetFrameworkTargetsVersion =
+ this->GetTargetFrameworkTargetsVersion()) {
+ mf->AddDefinition("CMAKE_VS_TARGET_FRAMEWORK_TARGETS_VERSION",
+ *targetFrameworkTargetsVersion);
+ }
+
+ // 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);
+}
+
+cm::optional<std::string> const&
+cmGlobalVisualStudio8Generator::GetTargetFrameworkVersion() const
+{
+ return this->DefaultTargetFrameworkVersion;
+}
+
+cm::optional<std::string> const&
+cmGlobalVisualStudio8Generator::GetTargetFrameworkIdentifier() const
+{
+ return this->DefaultTargetFrameworkIdentifier;
+}
+
+cm::optional<std::string> const&
+cmGlobalVisualStudio8Generator::GetTargetFrameworkTargetsVersion() const
+{
+ return this->DefaultTargetFrameworkTargetsVersion;
}
std::string cmGlobalVisualStudio8Generator::GetGenerateStampList()