summaryrefslogtreecommitdiffstats
path: root/Source/cmVisualStudio10TargetGenerator.cxx
diff options
context:
space:
mode:
authorBastien Schatt <bastien.schatt@magestik.fr>2018-08-12 14:06:56 (GMT)
committerBastien Schatt <bastien.schatt@magestik.fr>2018-08-12 14:06:56 (GMT)
commite4ba1f5a94e25feb0b220637a34eea2e63000c54 (patch)
tree0c3b63061f9f04cb17a5b5236c332fa990a55db8 /Source/cmVisualStudio10TargetGenerator.cxx
parent0f17dc51c262c7414139516d4327eeff8b0865a3 (diff)
downloadCMake-e4ba1f5a94e25feb0b220637a34eea2e63000c54.zip
CMake-e4ba1f5a94e25feb0b220637a34eea2e63000c54.tar.gz
CMake-e4ba1f5a94e25feb0b220637a34eea2e63000c54.tar.bz2
VS: Disallow ReferenceOutputAssembly in ProjectReference if not possible
Explicitly turn off `ReferenceOutputAssembly` in `ProjectReference` elements naming other project files whose types do not produce assemblies. We already do this for `C#` but it makes sense for other languages too. Fixes: #17906
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx44
1 files changed, 21 insertions, 23 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 41567a3..114f5ec 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -3778,31 +3778,29 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences(Elem& e0)
e2.Element("Project", "{" + this->GlobalGenerator->GetGUID(name) + "}");
e2.Element("Name", name);
this->WriteDotNetReferenceCustomTags(e2, name);
- 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.
- auto referenceNotManaged =
- dt->GetManagedType("") < cmGeneratorTarget::ManagedType::Mixed;
- // Workaround to check for manually set /clr flags.
- if (referenceNotManaged) {
- if (const auto* flags = dt->GetProperty("COMPILE_OPTIONS")) {
- std::string flagsStr = flags;
- if (flagsStr.find("clr") != std::string::npos) {
- // There is a warning already issued when building the flags.
- referenceNotManaged = false;
- }
+
+ // If the dependency target is not managed (compiled with /clr or
+ // C# target) we cannot reference it and have to set
+ // 'ReferenceOutputAssembly' to false.
+ auto referenceNotManaged =
+ dt->GetManagedType("") < cmGeneratorTarget::ManagedType::Mixed;
+ // Workaround to check for manually set /clr flags.
+ if (referenceNotManaged) {
+ if (const auto* flags = dt->GetProperty("COMPILE_OPTIONS")) {
+ std::string flagsStr = flags;
+ if (flagsStr.find("clr") != std::string::npos) {
+ // There is a warning already issued when building the flags.
+ referenceNotManaged = false;
}
}
- // Workaround for static library C# targets
- if (referenceNotManaged &&
- dt->GetType() == cmStateEnums::STATIC_LIBRARY) {
- referenceNotManaged = !dt->HasLanguage("CSharp", "");
- }
- if (referenceNotManaged) {
- e2.Element("ReferenceOutputAssembly", "false");
- e2.Element("CopyToOutputDirectory", "Never");
- }
+ }
+ // Workaround for static library C# targets
+ if (referenceNotManaged && dt->GetType() == cmStateEnums::STATIC_LIBRARY) {
+ referenceNotManaged = !dt->HasLanguage("CSharp", "");
+ }
+ if (referenceNotManaged) {
+ e2.Element("ReferenceOutputAssembly", "false");
+ e2.Element("CopyToOutputDirectory", "Never");
}
}
}