diff options
author | Michael Stürmer <michael.stuermer@schaeffler.com> | 2018-04-23 05:39:33 (GMT) |
---|---|---|
committer | Michael Stürmer <michael.stuermer@schaeffler.com> | 2018-04-24 05:05:18 (GMT) |
commit | 59ec7d50bdad2f07a32f3efffdad448f57ec7459 (patch) | |
tree | 29f4be96bbdb7831ffa4f9a7de15718bdcc35ea7 /Source/cmVisualStudio10TargetGenerator.cxx | |
parent | 663f5120f4e20ec716c742fea1d35cced3e3871f (diff) | |
download | CMake-59ec7d50bdad2f07a32f3efffdad448f57ec7459.zip CMake-59ec7d50bdad2f07a32f3efffdad448f57ec7459.tar.gz CMake-59ec7d50bdad2f07a32f3efffdad448f57ec7459.tar.bz2 |
cmVisualStudio10TargetGenerator: fix for backward compatibility
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 269bc11..840494c 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -3773,11 +3773,24 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences() "{" + this->GlobalGenerator->GetGUID(name) + "}", 3); this->WriteElem("Name", name, 3); this->WriteDotNetReferenceCustomTags(name); - // If the target is not compiled with any /clr flag, there is - // no assembly to reference. - if (this->Managed && - dt->GetManagedType("") < cmGeneratorTarget::ManagedType::Mixed) { - this->WriteElem("ReferenceOutputAssembly", "false", 3); + if (this->Managed) { + // If the dependency target is not managed (compiled with /clr or + // C# target) we cannot reference it and have to set + // 'ReferenceOutputAssembly' to false. + 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); } |