diff options
author | ζeh Matt <5415177+ZehMatt@users.noreply.github.com> | 2022-10-25 18:27:23 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-10-28 15:55:58 (GMT) |
commit | eef13a4b33ebfec6023e56128bbd2804adc9a96b (patch) | |
tree | bdeb2b3048e6a6c71447a6d9275b8bf2af558aa9 /Source | |
parent | 0815329dbc16283dcb22cccce60c731ff4e2652c (diff) | |
download | CMake-eef13a4b33ebfec6023e56128bbd2804adc9a96b.zip CMake-eef13a4b33ebfec6023e56128bbd2804adc9a96b.tar.gz CMake-eef13a4b33ebfec6023e56128bbd2804adc9a96b.tar.bz2 |
VS: Add COMMON_LANGUAGE_RUNTIME support for "netcore"
Generate `CLRSupport` for Visual Studio projects.
Fixes: #22054
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 9 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 7 |
2 files changed, 12 insertions, 4 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 321122a..8fd7321 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -8515,9 +8515,14 @@ cmGeneratorTarget::ManagedType cmGeneratorTarget::CheckManagedType( // lib // 2. empty propval: add /clr as flag, mixed unmanaged/managed // target, has import lib - // 3. any value (safe,pure): add /clr:[propval] as flag, target with + // 3. netcore propval: add /clr:netcore as flag, mixed + // unmanaged/managed target, has import lib. + // 4. any value (safe,pure): add /clr:[propval] as flag, target with // managed code only, no import lib - return propval.empty() ? ManagedType::Mixed : ManagedType::Managed; + if (propval.empty() || propval == "netcore") { + return ManagedType::Mixed; + } + return ManagedType::Managed; } cmGeneratorTarget::ManagedType cmGeneratorTarget::GetManagedType( diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 4cfb561..c982713 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -3316,9 +3316,12 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( } } - if (this->ProjectType != VsProjectType::csproj && clOptions.IsManaged()) { + if (this->ProjectType != VsProjectType::csproj && + (clOptions.IsManaged() || clOptions.HasFlag("CLRSupport"))) { this->Managed = true; - std::string managedType = clOptions.GetFlag("CompileAsManaged"); + std::string managedType = clOptions.HasFlag("CompileAsManaged") + ? clOptions.GetFlag("CompileAsManaged") + : "Mixed"; if (managedType == "Safe" || managedType == "Pure") { // force empty calling convention if safe clr is used clOptions.AddFlag("CallingConvention", ""); |