From d3073828f056ceb965aa33ed0c04477d3dba7fa8 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 30 May 2006 16:23:24 -0400 Subject: [PATCH] BUG: Fix progress when total number of source files is less than 100. --- Source/cmGlobalUnixMakefileGenerator3.cxx | 26 +++++++++++++++++++---- Source/cmLocalUnixMakefileGenerator3.cxx | 11 +++++++--- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 037fb6844..b7f679755 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -703,15 +703,23 @@ cmGlobalUnixMakefileGenerator3 std::string progressDir = lg->GetMakefile()->GetHomeOutputDirectory(); progressDir += "/CMakeFiles"; + + { + // TODO: Convert the total progress count to a make variable. cmOStringStream progCmd; - progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; + progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # in target progCmd << lg->Convert(progressDir.c_str(), cmLocalGenerator::FULL, cmLocalGenerator::SHELL); + int n = this->GetNumberOfSourceFiles(); + if(n > 100) + { + n = 100; + } if (this->NumberOfSourceFiles) { progCmd << " " << - (100*this->GetTargetTotalNumberOfSourceFiles(t->second))/ + (n*this->GetTargetTotalNumberOfSourceFiles(t->second))/ this->NumberOfSourceFiles; } else @@ -719,9 +727,19 @@ cmGlobalUnixMakefileGenerator3 progCmd << " 0"; } commands.push_back(progCmd.str()); + } commands.push_back(lg->GetRecursiveMakeCall ("CMakeFiles/Makefile2",t->second.GetName())); - depends.clear(); + { + cmOStringStream progCmd; + progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0 + progCmd << lg->Convert(progressDir.c_str(), + cmLocalGenerator::FULL, + cmLocalGenerator::SHELL); + progCmd << " 0"; + commands.push_back(progCmd.str()); + } + depends.clear(); depends.push_back("cmake_check_build_system"); lg->WriteMakeRule(ruleFileStream, "Build rule for target.", @@ -840,7 +858,7 @@ cmGlobalUnixMakefileGenerator3 lg->GetMakefile()->GetHomeOutputDirectory(); progressDir += "/CMakeFiles"; cmOStringStream progCmd; - progCmd << "$(CMAKE_COMMAND) -E cmake_progress_report "; + progCmd << "$(CMAKE_COMMAND) -E cmake_progress_report "; // all target counts progCmd << lg->Convert(progressDir.c_str(), cmLocalGenerator::FULL, cmLocalGenerator::SHELL); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index ae7cd044e..a3bd5c9d8 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1402,13 +1402,18 @@ void cmLocalUnixMakefileGenerator3 std::string progressDir = this->Makefile->GetHomeOutputDirectory(); progressDir += "/CMakeFiles"; cmOStringStream progCmd; - progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; + progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # src files progCmd << this->Convert(progressDir.c_str(), cmLocalGenerator::FULL, cmLocalGenerator::SHELL); cmGlobalUnixMakefileGenerator3 *gg = static_cast(this->GlobalGenerator); - progCmd << " " << gg->GetNumberOfSourceFiles(); + int n = gg->GetNumberOfSourceFiles(); + if(n > 100) + { + n = 100; + } + progCmd << " " << n; commands.push_back(progCmd.str()); } @@ -1422,7 +1427,7 @@ void cmLocalUnixMakefileGenerator3 std::string progressDir = this->Makefile->GetHomeOutputDirectory(); progressDir += "/CMakeFiles"; cmOStringStream progCmd; - progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; + progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0 progCmd << this->Convert(progressDir.c_str(), cmLocalGenerator::FULL, cmLocalGenerator::SHELL);