ENH: Slight improvement in genreation time by recording the setting of CMAKE_COLOR_MAKEFILE in an ivar of each local generator at the beginning of generation. This avoids many repeated table lookups.

This commit is contained in:
Brad King 2006-05-25 14:16:19 -04:00
parent 9704c8f8c3
commit ff41664c6b
2 changed files with 11 additions and 3 deletions

View File

@ -48,6 +48,7 @@ cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3()
this->DefineWindowsNULL = false; this->DefineWindowsNULL = false;
this->UnixCD = true; this->UnixCD = true;
this->ForceVerboseMakefiles=false; this->ForceVerboseMakefiles=false;
this->ColorMakefile = false;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -75,6 +76,10 @@ void cmLocalUnixMakefileGenerator3::Generate()
// Setup our configuration variables for this directory. // Setup our configuration variables for this directory.
this->ConfigureOutputPaths(); this->ConfigureOutputPaths();
// Record whether color makefiles are enabled to avoid checking many
// times later.
this->ColorMakefile = this->Makefile->IsOn("CMAKE_COLOR_MAKEFILE");
// Generate the rule files for each target. // Generate the rule files for each target.
cmTargets& targets = this->Makefile->GetTargets(); cmTargets& targets = this->Makefile->GetTargets();
std::string empty; std::string empty;
@ -860,8 +865,7 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands,
// Choose the color for the text. // Choose the color for the text.
std::string color_name; std::string color_name;
#ifdef CMAKE_BUILD_WITH_CMAKE #ifdef CMAKE_BUILD_WITH_CMAKE
if(this->GlobalGenerator->GetToolSupportsColor() && if(this->GlobalGenerator->GetToolSupportsColor() && this->ColorMakefile)
this->Makefile->IsOn("CMAKE_COLOR_MAKEFILE"))
{ {
// See cmake::ExecuteEchoColor in cmake.cxx for these options. // See cmake::ExecuteEchoColor in cmake.cxx for these options.
// This color set is readable on both black and white backgrounds. // This color set is readable on both black and white backgrounds.

View File

@ -309,6 +309,10 @@ private:
std::string HomeRelativeOutputPath; std::string HomeRelativeOutputPath;
/* Copy the setting of CMAKE_COLOR_MAKEFILE from the makefile at the
beginning of generation to avoid many duplicate lookups. */
bool ColorMakefile;
std::map<cmStdString,std::vector<cmTarget *> > LocalObjectFiles; std::map<cmStdString,std::vector<cmTarget *> > LocalObjectFiles;
/* does the work for each target */ /* does the work for each target */