1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-20 04:24:36 +08:00

cmVisualStudio10TargetGenerator: fix for backward compatibility

This commit is contained in:
Michael Stürmer
2018-04-23 07:39:33 +02:00
parent 663f5120f4
commit 59ec7d50bd

View File

@@ -3773,11 +3773,24 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences()
"{" + this->GlobalGenerator->GetGUID(name) + "}", 3); "{" + this->GlobalGenerator->GetGUID(name) + "}", 3);
this->WriteElem("Name", name, 3); this->WriteElem("Name", name, 3);
this->WriteDotNetReferenceCustomTags(name); this->WriteDotNetReferenceCustomTags(name);
// If the target is not compiled with any /clr flag, there is if (this->Managed) {
// no assembly to reference. // If the dependency target is not managed (compiled with /clr or
if (this->Managed && // C# target) we cannot reference it and have to set
dt->GetManagedType("") < cmGeneratorTarget::ManagedType::Mixed) { // 'ReferenceOutputAssembly' to false.
this->WriteElem("ReferenceOutputAssembly", "false", 3); cmGeneratorTarget::ManagedType check =
cmGeneratorTarget::ManagedType::Mixed;
// FIXME: These (5) lines should be removed. They are here to allow
// manual setting of the /clr flag in compiler options. Setting
// /clr manually makes cmGeneratorTarget::GetManagedType() return
// 'Native' instead of 'Mixed' or 'Managed'.
check = cmGeneratorTarget::ManagedType::Native;
bool unmanagedStatic = false;
if (dt->GetType() == cmStateEnums::STATIC_LIBRARY) {
unmanagedStatic = !dt->HasLanguage("CSharp", "");
}
if (dt->GetManagedType("") < check || unmanagedStatic) {
this->WriteElem("ReferenceOutputAssembly", "false", 3);
}
} }
this->WriteString("</ProjectReference>\n", 2); this->WriteString("</ProjectReference>\n", 2);
} }