diff options
author | Brad King <brad.king@kitware.com> | 2020-01-24 15:55:16 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-01-24 15:55:26 (GMT) |
commit | 786b56942b359e79cce489f12bf4426b4dc505de (patch) | |
tree | d31263fd656d2b0cf9d902281f8f92d3c1ab837c /Source | |
parent | 4dbc9dfc7a1458878a26e1f0cec1a382e14bf48a (diff) | |
parent | ae1e1909a13fa6e68c33fe92cc8f5c76c30df76f (diff) | |
download | CMake-786b56942b359e79cce489f12bf4426b4dc505de.zip CMake-786b56942b359e79cce489f12bf4426b4dc505de.tar.gz CMake-786b56942b359e79cce489f12bf4426b4dc505de.tar.bz2 |
Merge topic 'vs-dotnet-standard-core'
ae1e1909a1 VS: Add support for .NET Standard and .NET Core
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4240
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmTarget.cxx | 1 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 47 |
2 files changed, 31 insertions, 17 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index a0b3138..d46bf56 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -517,6 +517,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, } if (impl->TargetType <= cmStateEnums::UTILITY) { + initProp("DOTNET_TARGET_FRAMEWORK"); initProp("DOTNET_TARGET_FRAMEWORK_VERSION"); } diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index f707bb4..fd94bc9 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -483,23 +483,33 @@ void cmVisualStudio10TargetGenerator::Generate() } e1.Element("ProjectName", projLabel); { - // TODO: add deprecation warning for VS_* property? - const char* targetFrameworkVersion = - this->GeneratorTarget->GetProperty( - "VS_DOTNET_TARGET_FRAMEWORK_VERSION"); - if (!targetFrameworkVersion) { - targetFrameworkVersion = this->GeneratorTarget->GetProperty( - "DOTNET_TARGET_FRAMEWORK_VERSION"); - } - if (!targetFrameworkVersion && this->ProjectType == csproj && - this->GlobalGenerator->TargetsWindowsCE() && - this->GlobalGenerator->GetVersion() == - cmGlobalVisualStudioGenerator::VS12) { - // VS12 .NETCF default to .NET framework 3.9 - targetFrameworkVersion = "v3.9"; - } - if (targetFrameworkVersion) { - e1.Element("TargetFrameworkVersion", targetFrameworkVersion); + const char* targetFramework = + this->GeneratorTarget->GetProperty("DOTNET_TARGET_FRAMEWORK"); + if (targetFramework) { + if (std::strchr(targetFramework, ';') != nullptr) { + e1.Element("TargetFrameworks", targetFramework); + } else { + e1.Element("TargetFramework", targetFramework); + } + } else { + // TODO: add deprecation warning for VS_* property? + const char* targetFrameworkVersion = + this->GeneratorTarget->GetProperty( + "VS_DOTNET_TARGET_FRAMEWORK_VERSION"); + if (!targetFrameworkVersion) { + targetFrameworkVersion = this->GeneratorTarget->GetProperty( + "DOTNET_TARGET_FRAMEWORK_VERSION"); + } + if (!targetFrameworkVersion && this->ProjectType == csproj && + this->GlobalGenerator->TargetsWindowsCE() && + this->GlobalGenerator->GetVersion() == + cmGlobalVisualStudioGenerator::VS12) { + // VS12 .NETCF default to .NET framework 3.9 + targetFrameworkVersion = "v3.9"; + } + if (targetFrameworkVersion) { + e1.Element("TargetFrameworkVersion", targetFrameworkVersion); + } } if (this->ProjectType == vcxproj && this->GlobalGenerator->TargetsWindowsCE()) { @@ -4110,6 +4120,9 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences(Elem& e0) e2.Element("Project", "{" + this->GlobalGenerator->GetGUID(name) + "}"); e2.Element("Name", name); this->WriteDotNetReferenceCustomTags(e2, name); + if (dt->IsCSharpOnly() || cmHasLiteralSuffix(path, "csproj")) { + e2.Element("SkipGetTargetFrameworkProperties", "true"); + } // Don't reference targets that don't produce any output. if (dt->GetManagedType("") == cmGeneratorTarget::ManagedType::Undefined) { |