From bdb530191dba75f8b358367d6da9dd8aa8e763e3 Mon Sep 17 00:00:00 2001 From: Ken Martin Date: Tue, 29 Aug 2006 12:55:11 -0400 Subject: [PATCH] BUG: bad progress for named top level targets --- Source/cmGlobalUnixMakefileGenerator3.cxx | 30 +++++++++++++++-------- Source/cmGlobalUnixMakefileGenerator3.h | 3 ++- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index a647a9c26..d95518391 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -823,8 +823,10 @@ cmGlobalUnixMakefileGenerator3 cmLocalGenerator::FULL, cmLocalGenerator::SHELL); // + std::set emitted; progCmd << " " - << this->GetTargetTotalNumberOfActions(t->second); + << this->GetTargetTotalNumberOfActions(t->second, + emitted); commands.push_back(progCmd.str()); } std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash(); @@ -895,18 +897,26 @@ cmGlobalUnixMakefileGenerator3 //---------------------------------------------------------------------------- int cmGlobalUnixMakefileGenerator3 -::GetTargetTotalNumberOfActions(cmTarget& target) +::GetTargetTotalNumberOfActions(cmTarget& target, + std::set &emitted) { - cmLocalUnixMakefileGenerator3 *lg = - static_cast - (target.GetMakefile()->GetLocalGenerator()); - int result = static_cast(lg->ProgressFiles[target.GetName()].size()); - std::vector& depends = this->GetTargetDepends(target); + // do not double count + int result = 0; - std::vector::iterator i; - for (i = depends.begin(); i != depends.end(); ++i) + if(emitted.insert(target.GetName()).second) { - result += this->GetTargetTotalNumberOfActions(**i); + cmLocalUnixMakefileGenerator3 *lg = + static_cast + (target.GetMakefile()->GetLocalGenerator()); + result = static_cast(lg->ProgressFiles[target.GetName()].size()); + + std::vector& depends = this->GetTargetDepends(target); + + std::vector::iterator i; + for (i = depends.begin(); i != depends.end(); ++i) + { + result += this->GetTargetTotalNumberOfActions(**i, emitted); + } } return result; diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 9e78f7a2f..f07451073 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -124,7 +124,8 @@ public: const char* config, bool ignoreErrors, bool fast); // returns some progress informaiton - int GetTargetTotalNumberOfActions(cmTarget& target); + int GetTargetTotalNumberOfActions(cmTarget& target, + std::set &emitted); unsigned long GetNumberOfProgressActionsInAll (cmLocalUnixMakefileGenerator3 *lg);