summaryrefslogtreecommitdiffstats
path: root/Source
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
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')
-rw-r--r--Source/cmComputeTargetDepends.cxx20
-rw-r--r--Source/cmComputeTargetDepends.h1
-rw-r--r--Source/cmake.cxx10
3 files changed, 29 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());
}
diff --git a/Source/cmComputeTargetDepends.h b/Source/cmComputeTargetDepends.h
index e3e15e1..da29aa1 100644
--- a/Source/cmComputeTargetDepends.h
+++ b/Source/cmComputeTargetDepends.h
@@ -54,6 +54,7 @@ private:
cmGlobalGenerator* GlobalGenerator;
bool DebugMode;
+ bool NoCycles;
// Collect all targets.
std::vector<cmTarget*> Targets;
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index ea36c0b..dcc3d50 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -3415,6 +3415,16 @@ void cmake::DefineProperties(cmake *cm)
"This property causes it to display details of its analysis to stderr.");
cm->DefineProperty(
+ "GLOBAL_DEPENDS_NO_CYCLES", cmProperty::GLOBAL,
+ "Disallow global target dependency graph cycles.",
+ "CMake automatically analyzes the global inter-target dependency graph "
+ "at the beginning of native build system generation. "
+ "It reports an error if the dependency graph contains a cycle that "
+ "does not consist of all STATIC library targets. "
+ "This property tells CMake to disallow all cycles completely, even "
+ "among static libraries.");
+
+ cm->DefineProperty(
"ALLOW_DUPLICATE_CUSTOM_TARGETS", cmProperty::GLOBAL,
"Allow duplicate custom targets to be created.",
"Normally CMake requires that all targets built in a project have "