VS: Add COMMON_LANGUAGE_RUNTIME support for "netcore"

Generate `CLRSupport` for Visual Studio projects.

Fixes: #22054
This commit is contained in:
ζeh Matt
2022-10-25 21:27:23 +03:00
committed by Brad King
parent 0815329dbc
commit eef13a4b33
14 changed files with 160 additions and 4 deletions
+7 -2
View File
@@ -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(
+5 -2
View File
@@ -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", "");