summaryrefslogtreecommitdiffstats
path: root/Source/cmComputeTargetDepends.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-08-24 13:54:27 (GMT)
committerBrad King <brad.king@kitware.com>2009-08-24 13:54:27 (GMT)
commitfd62a7cac44ba95468767dd0f9b000da6d664b8d (patch)
tree6ca8a38c67d94937757cdb997e62091c5b461a0c /Source/cmComputeTargetDepends.cxx
parenta9be85da2ecd7677d3ba72dc2e279541a32907c2 (diff)
downloadCMake-fd62a7cac44ba95468767dd0f9b000da6d664b8d.zip
CMake-fd62a7cac44ba95468767dd0f9b000da6d664b8d.tar.gz
CMake-fd62a7cac44ba95468767dd0f9b000da6d664b8d.tar.bz2
Create GLOBAL_DEPENDS_NO_CYCLES property
This global property disallows cycles in the inter-target dependency graph even among STATIC libraries. See issue #9444.
Diffstat (limited to 'Source/cmComputeTargetDepends.cxx')
-rw-r--r--Source/cmComputeTargetDepends.cxx20
1 files changed, 18 insertions, 2 deletions
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index 7a6e81f..12d5696 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -103,6 +103,7 @@ cmComputeTargetDepends::cmComputeTargetDepends(cmGlobalGenerator* gg)
this->GlobalGenerator = gg;
cmake* cm = this->GlobalGenerator->GetCMakeInstance();
this->DebugMode = cm->GetPropertyAsBool("GLOBAL_DEPENDS_DEBUG_MODE");
+ this->NoCycles = cm->GetPropertyAsBool("GLOBAL_DEPENDS_NO_CYCLES");
}
//----------------------------------------------------------------------------
@@ -344,6 +345,13 @@ cmComputeTargetDepends
continue;
}
+ // Immediately complain if no cycles are allowed at all.
+ if(this->NoCycles)
+ {
+ this->ComplainAboutBadComponent(ccg, c);
+ return false;
+ }
+
// Make sure the component is all STATIC_LIBRARY targets.
for(NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
{
@@ -391,8 +399,16 @@ cmComputeTargetDepends
}
}
}
- e << "At least one of these targets is not a STATIC_LIBRARY. "
- << "Cyclic dependencies are allowed only among static libraries.";
+ if(this->NoCycles)
+ {
+ e << "The GLOBAL_DEPENDS_NO_CYCLES global property is enabled, so "
+ << "cyclic dependencies are not allowed even among static libraries.";
+ }
+ else
+ {
+ e << "At least one of these targets is not a STATIC_LIBRARY. "
+ << "Cyclic dependencies are allowed only among static libraries.";
+ }
cmSystemTools::Error(e.str().c_str());
}