diff options
author | Brad King <brad.king@kitware.com> | 2010-08-25 14:07:25 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2010-08-25 21:10:00 (GMT) |
commit | 681cf011dde81c08c0404569289110f9585c6daf (patch) | |
tree | 63c7bab28a00c110e4946d13aeb168c5d1fa66bf /Source/cmComputeTargetDepends.cxx | |
parent | 7be2617b5a52529ce0ca33e6c878a0294e1e2781 (diff) | |
download | CMake-681cf011dde81c08c0404569289110f9585c6daf.zip CMake-681cf011dde81c08c0404569289110f9585c6daf.tar.gz CMake-681cf011dde81c08c0404569289110f9585c6daf.tar.bz2 |
Distinguish "strong" and "weak" target dependency edges
Utility dependencies are "strong" because they must be enforced to
generate a working build. Link dependencies are "weak" because they can
be broken in the case of a static library cycle.
Diffstat (limited to 'Source/cmComputeTargetDepends.cxx')
-rw-r--r-- | Source/cmComputeTargetDepends.cxx | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index e82606c..2b6b5ec 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -195,15 +195,13 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) // Get the depender. cmTarget* depender = this->Targets[depender_index]; - // Keep track of dependencies already listed. - std::set<cmStdString> emitted; - - // A target should not depend on itself. - emitted.insert(depender->GetName()); - // Loop over all targets linked directly. + { cmTarget::LinkLibraryVectorType const& tlibs = depender->GetOriginalLinkLibraries(); + std::set<cmStdString> emitted; + // A target should not depend on itself. + emitted.insert(depender->GetName()); for(cmTarget::LinkLibraryVectorType::const_iterator lib = tlibs.begin(); lib != tlibs.end(); ++lib) { @@ -213,9 +211,14 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) this->AddTargetDepend(depender_index, lib->first.c_str(), true); } } + } // Loop over all utility dependencies. + { std::set<cmStdString> const& tutils = depender->GetUtilities(); + std::set<cmStdString> emitted; + // A target should not depend on itself. + emitted.insert(depender->GetName()); for(std::set<cmStdString>::const_iterator util = tutils.begin(); util != tutils.end(); ++util) { @@ -225,6 +228,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) this->AddTargetDepend(depender_index, util->c_str(), false); } } + } } //---------------------------------------------------------------------------- @@ -272,7 +276,8 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, int dependee_index = tii->second; // Add this entry to the dependency graph. - this->InitialGraph[depender_index].push_back(dependee_index); + this->InitialGraph[depender_index].push_back( + cmGraphEdge(dependee_index, !linking)); } //---------------------------------------------------------------------------- @@ -291,8 +296,8 @@ cmComputeTargetDepends::DisplayGraph(Graph const& graph, const char* name) { int dependee_index = *ni; cmTarget* dependee = this->Targets[dependee_index]; - fprintf(stderr, " depends on target %d [%s]\n", dependee_index, - dependee->GetName()); + fprintf(stderr, " depends on target %d [%s] (%s)\n", dependee_index, + dependee->GetName(), ni->IsStrong()? "strong" : "weak"); } } fprintf(stderr, "\n"); @@ -390,7 +395,8 @@ cmComputeTargetDepends if(cmap[j] == c) { cmTarget* dependee = this->Targets[j]; - e << " depends on \"" << dependee->GetName() << "\"\n"; + e << " depends on \"" << dependee->GetName() << "\"" + << " (" << (ni->IsStrong()? "strong" : "weak") << ")\n"; } } } |