summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx21
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.h3
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx4
3 files changed, 19 insertions, 9 deletions
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 13bf515..037fb68 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -117,7 +117,8 @@ cmGlobalUnixMakefileGenerator3
int cmGlobalUnixMakefileGenerator3::ShouldAddProgressRule()
{
// add progress to 100 source files
- if ((((this->NumberOfSourceFilesWritten + 1)*100)/this->NumberOfSourceFiles)
+ if (this->NumberOfSourceFiles &&
+ (((this->NumberOfSourceFilesWritten + 1)*100)/this->NumberOfSourceFiles)
-(this->NumberOfSourceFilesWritten*100)/this->NumberOfSourceFiles)
{
this->NumberOfSourceFilesWritten++;
@@ -173,9 +174,8 @@ GetNumberOfCompilableSourceFilesForTarget(cmTarget &tgt)
//----------------------------------------------------------------------------
void cmGlobalUnixMakefileGenerator3::Generate()
{
- // initialize progress, always pretend there is at least 1 file
- // to avoid division errors etc
- this->NumberOfSourceFiles = 1;
+ // initialize progress
+ this->NumberOfSourceFiles = 0;
unsigned int i;
for (i = 0; i < this->LocalGenerators.size(); ++i)
{
@@ -708,9 +708,16 @@ cmGlobalUnixMakefileGenerator3
progCmd << lg->Convert(progressDir.c_str(),
cmLocalGenerator::FULL,
cmLocalGenerator::SHELL);
- progCmd << " " <<
- (100*this->GetTargetTotalNumberOfSourceFiles(t->second))/
- this->NumberOfSourceFiles;
+ if (this->NumberOfSourceFiles)
+ {
+ progCmd << " " <<
+ (100*this->GetTargetTotalNumberOfSourceFiles(t->second))/
+ this->NumberOfSourceFiles;
+ }
+ else
+ {
+ progCmd << " 0";
+ }
commands.push_back(progCmd.str());
commands.push_back(lg->GetRecursiveMakeCall
("CMakeFiles/Makefile2",t->second.GetName()));
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h
index 90e3be1..d8fe3f7 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -127,7 +127,8 @@ public:
int ShouldAddProgressRule();
int GetNumberOfCompilableSourceFilesForTarget(cmTarget &tgt);
int GetTargetTotalNumberOfSourceFiles(cmTarget& target);
-
+ int GetNumberOfSourceFiles() { return this->NumberOfSourceFiles; };
+
// what targets does the specified target depend on
std::vector<cmTarget *>& GetTargetDepends(cmTarget& target);
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index e96dcde..e1a9a46 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1402,7 +1402,9 @@ void cmLocalUnixMakefileGenerator3
progCmd << this->Convert(progressDir.c_str(),
cmLocalGenerator::FULL,
cmLocalGenerator::SHELL);
- progCmd << " 100";
+ cmGlobalUnixMakefileGenerator3 *gg =
+ static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator);
+ progCmd << " " << gg->GetNumberOfSourceFiles();
commands.push_back(progCmd.str());
}