summaryrefslogtreecommitdiff
path: root/Source/cmGlobalUnixMakefileGenerator3.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-08-02 10:22:12 +0200
committerStephen Kelly <steveire@gmail.com>2015-08-23 18:05:01 +0200
commitb9eb3cd1405d423bf0156fabc3340c396b1f308c (patch)
treef5abb02f18ab2e40dbc987bb4ea63188c41835fc /Source/cmGlobalUnixMakefileGenerator3.cxx
parentf5d2b7a6942ee291f8e0d4e8a7a7869037913de7 (diff)
downloadcmake-b9eb3cd1405d423bf0156fabc3340c396b1f308c.tar.gz
cmGlobalGenerator: Move LG to target map to subclass.
This is the only user.
Diffstat (limited to 'Source/cmGlobalUnixMakefileGenerator3.cxx')
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx43
1 files changed, 43 insertions, 0 deletions
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 76d059ee24..255b59d94c 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -917,6 +917,49 @@ cmGlobalUnixMakefileGenerator3
}
}
+// Build a map that contains a the set of targets used by each local
+// generator directory level.
+void cmGlobalUnixMakefileGenerator3::FillLocalGeneratorToTargetMap()
+{
+ this->LocalGeneratorToTargetMap.clear();
+ // Loop over all targets in all local generators.
+ for(std::vector<cmLocalGenerator*>::const_iterator
+ lgi = this->LocalGenerators.begin();
+ lgi != this->LocalGenerators.end(); ++lgi)
+ {
+ cmLocalGenerator* lg = *lgi;
+ cmMakefile* mf = lg->GetMakefile();
+ cmTargets const& targets = mf->GetTargets();
+ for(cmTargets::const_iterator t = targets.begin(); t != targets.end(); ++t)
+ {
+ cmTarget const& target = t->second;
+
+ cmGeneratorTarget* gt = this->GetGeneratorTarget(&target);
+
+ // Consider the directory containing the target and all its
+ // parents until something excludes the target.
+ for(cmLocalGenerator* clg = lg; clg && !this->IsExcluded(clg, gt);
+ clg = clg->GetParent())
+ {
+ // This local generator includes the target.
+ std::set<cmGeneratorTarget const*>& targetSet =
+ this->LocalGeneratorToTargetMap[clg];
+ targetSet.insert(gt);
+
+ // Add dependencies of the included target. An excluded
+ // target may still be included if it is a dependency of a
+ // non-excluded target.
+ TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(gt);
+ for(TargetDependSet::const_iterator ti = tgtdeps.begin();
+ ti != tgtdeps.end(); ++ti)
+ {
+ targetSet.insert(*ti);
+ }
+ }
+ }
+ }
+}
+
//----------------------------------------------------------------------------
size_t
cmGlobalUnixMakefileGenerator3