Browse Source

ENH: Factor out makefile progress rule commands

This factors duplicate progress rule code into a common method.
Brad King 17 years ago
parent
commit
741ae600c4
2 changed files with 20 additions and 24 deletions
  1. 18 24
      Source/cmMakefileTargetGenerator.cxx
  2. 2 0
      Source/cmMakefileTargetGenerator.h

+ 18 - 24
Source/cmMakefileTargetGenerator.cxx

@@ -580,18 +580,7 @@ cmMakefileTargetGenerator
   std::vector<std::string> commands;
 
   // add in a progress call if needed
-  std::string progressDir = this->Makefile->GetHomeOutputDirectory();
-  progressDir += cmake::GetCMakeFilesDirectory();
-  cmOStringStream progCmd;
-  progCmd << "$(CMAKE_COMMAND) -E cmake_progress_report ";
-  progCmd << this->LocalGenerator->Convert(progressDir.c_str(),
-                                           cmLocalGenerator::FULL,
-                                           cmLocalGenerator::SHELL);
-  this->NumberOfProgressActions++;
-  progCmd << " $(CMAKE_PROGRESS_" 
-          << this->NumberOfProgressActions 
-          << ")";
-  commands.push_back(progCmd.str());
+  this->AppendProgress(commands);
 
   std::string buildEcho = "Building ";
   buildEcho += lang;
@@ -1107,18 +1096,7 @@ void cmMakefileTargetGenerator
   if(!comment.empty())
     {
     // add in a progress call if needed
-    std::string progressDir = this->Makefile->GetHomeOutputDirectory();
-    progressDir += cmake::GetCMakeFilesDirectory();
-    cmOStringStream progCmd;
-    progCmd << "$(CMAKE_COMMAND) -E cmake_progress_report ";
-    progCmd << this->LocalGenerator->Convert(progressDir.c_str(),
-                                             cmLocalGenerator::FULL,
-                                             cmLocalGenerator::SHELL);
-    this->NumberOfProgressActions++;
-    progCmd << " $(CMAKE_PROGRESS_" 
-            << this->NumberOfProgressActions 
-            << ")";
-    commands.push_back(progCmd.str());
+    this->AppendProgress(commands);
     this->LocalGenerator
       ->AppendEcho(commands, comment.c_str(),
                    cmLocalUnixMakefileGenerator3::EchoGenerate);
@@ -1217,6 +1195,22 @@ cmMakefileTargetGenerator
   this->AddMultipleOutputPair(out, in);
 }
 
+//----------------------------------------------------------------------------
+void
+cmMakefileTargetGenerator::AppendProgress(std::vector<std::string>& commands)
+{
+  this->NumberOfProgressActions++;
+  std::string progressDir = this->Makefile->GetHomeOutputDirectory();
+  progressDir += cmake::GetCMakeFilesDirectory();
+  cmOStringStream progCmd;
+  progCmd << "$(CMAKE_COMMAND) -E cmake_progress_report ";
+  progCmd << this->LocalGenerator->Convert(progressDir.c_str(),
+                                           cmLocalGenerator::FULL,
+                                           cmLocalGenerator::SHELL);
+  progCmd << " $(CMAKE_PROGRESS_" << this->NumberOfProgressActions << ")";
+  commands.push_back(progCmd.str());
+}
+
 //----------------------------------------------------------------------------
 void
 cmMakefileTargetGenerator

+ 2 - 0
Source/cmMakefileTargetGenerator.h

@@ -103,6 +103,8 @@ protected:
   void GenerateExtraOutput(const char* out, const char* in,
                            bool symbolic = false);
 
+  void AppendProgress(std::vector<std::string>& commands);
+
   // write out the variable that lists the objects for this target
   void WriteObjectsVariable(std::string& variableName,
                             std::string& variableNameExternal);