summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-10-06 17:30:00 (GMT)
committerBrad King <brad.king@kitware.com>2009-10-06 17:30:00 (GMT)
commit9000b5a4ded0d805ea1cd7b82f9e87e9abcf6c31 (patch)
treeaef1cee06fabc865ba60710c52edbcddd1e7463b /Source/cmGlobalGenerator.cxx
parentd8efcfc787b08e52c28611347e4c60cddde00aa2 (diff)
downloadCMake-9000b5a4ded0d805ea1cd7b82f9e87e9abcf6c31.zip
CMake-9000b5a4ded0d805ea1cd7b82f9e87e9abcf6c31.tar.gz
CMake-9000b5a4ded0d805ea1cd7b82f9e87e9abcf6c31.tar.bz2
Avoid non-root copies of root-only targets
In cmGlobalGenerator::GetTargetSets we collect targets from all local generators in a tree or subtree corresponding to a project() command. Some targets, such as ALL_BUILD, are duplicated in each subdirectory with a project() command. For such targets we should keep only the copy for the top-most (root) local generator. Previously this filtering was done in each VS IDE generator, but it is easier to do it in one place when the targets are first encountered. This also fixes bad ALL_BUILD dependencies generated for VS 7.0 because the cmGlobalVisualStudio7Generator::WriteTargetDepends method was not filtering out duplicates. Now we avoid duplicates from the start.
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 25e7602..4734c50 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1953,6 +1953,11 @@ void cmGlobalGenerator::GetTargetSets(TargetDependSet& projectTargets,
for (cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l)
{
cmTarget* target = &l->second;
+ if(this->IsRootOnlyTarget(target) &&
+ target->GetMakefile() != root->GetMakefile())
+ {
+ continue;
+ }
// put the target in the set of original targets
originalTargets.insert(target);
// Get the set of targets that depend on target
@@ -1962,6 +1967,13 @@ void cmGlobalGenerator::GetTargetSets(TargetDependSet& projectTargets,
}
//----------------------------------------------------------------------------
+bool cmGlobalGenerator::IsRootOnlyTarget(cmTarget* target)
+{
+ return (target->GetType() == cmTarget::GLOBAL_TARGET ||
+ strcmp(target->GetName(), this->GetAllTargetName()) == 0);
+}
+
+//----------------------------------------------------------------------------
void cmGlobalGenerator::AddTargetDepends(cmTarget* target,
TargetDependSet& projectTargets)
{