diff options
author | Brad King <brad.king@kitware.com> | 2021-11-03 14:31:04 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-11-06 06:08:54 -0400 |
commit | f97f8537f371daa073edce34f54743d1f261c022 (patch) | |
tree | 30f5e72adfe40f1d2ee6e468878081f62c38627c /Source/cmGlobalVisualStudio8Generator.cxx | |
parent | e40cedddc0bcdd7d0317592a83fde42fd018f72f (diff) | |
download | cmake-f97f8537f371daa073edce34f54743d1f261c022.tar.gz |
VS: Model a default target framework
Add fields to the VS generator to select a target framework.
Migrate the existing default for VS 12 .NET CF for Windows CE.
Report the values in `CMAKE_VS_*` variables and use them for
the CSharp compiler id project too.
Issue: #22849
Diffstat (limited to 'Source/cmGlobalVisualStudio8Generator.cxx')
-rw-r--r-- | Source/cmGlobalVisualStudio8Generator.cxx | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 439d13e9d5..1e45813bb9 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -76,12 +76,48 @@ bool cmGlobalVisualStudio8Generator::SetGeneratorPlatform(std::string const& p, 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() { return "generate.stamp.list"; |