ENH: Factor out makefile progress rule commands

This factors duplicate progress rule code into a common method.
This commit is contained in:
Brad King 2009-03-16 16:22:13 -04:00
parent 7b9b56d80e
commit 741ae600c4
2 changed files with 20 additions and 24 deletions

View File

@ -580,18 +580,7 @@ cmMakefileTargetGenerator
std::vector<std::string> commands; std::vector<std::string> commands;
// add in a progress call if needed // add in a progress call if needed
std::string progressDir = this->Makefile->GetHomeOutputDirectory(); this->AppendProgress(commands);
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());
std::string buildEcho = "Building "; std::string buildEcho = "Building ";
buildEcho += lang; buildEcho += lang;
@ -1107,18 +1096,7 @@ void cmMakefileTargetGenerator
if(!comment.empty()) if(!comment.empty())
{ {
// add in a progress call if needed // add in a progress call if needed
std::string progressDir = this->Makefile->GetHomeOutputDirectory(); this->AppendProgress(commands);
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->LocalGenerator this->LocalGenerator
->AppendEcho(commands, comment.c_str(), ->AppendEcho(commands, comment.c_str(),
cmLocalUnixMakefileGenerator3::EchoGenerate); cmLocalUnixMakefileGenerator3::EchoGenerate);
@ -1217,6 +1195,22 @@ cmMakefileTargetGenerator
this->AddMultipleOutputPair(out, in); 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 void
cmMakefileTargetGenerator cmMakefileTargetGenerator

View File

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