From ff41664c6bf3ce91e155b08ef23f4f2e061ba857 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 25 May 2006 14:16:19 -0400 Subject: [PATCH] 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. --- Source/cmLocalUnixMakefileGenerator3.cxx | 8 ++++++-- Source/cmLocalUnixMakefileGenerator3.h | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index e1a9a4677..ae7cd044e 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -48,6 +48,7 @@ cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3() this->DefineWindowsNULL = false; this->UnixCD = true; this->ForceVerboseMakefiles=false; + this->ColorMakefile = false; } //---------------------------------------------------------------------------- @@ -75,6 +76,10 @@ void cmLocalUnixMakefileGenerator3::Generate() // Setup our configuration variables for this directory. 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. cmTargets& targets = this->Makefile->GetTargets(); std::string empty; @@ -860,8 +865,7 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector& commands, // Choose the color for the text. std::string color_name; #ifdef CMAKE_BUILD_WITH_CMAKE - if(this->GlobalGenerator->GetToolSupportsColor() && - this->Makefile->IsOn("CMAKE_COLOR_MAKEFILE")) + if(this->GlobalGenerator->GetToolSupportsColor() && this->ColorMakefile) { // See cmake::ExecuteEchoColor in cmake.cxx for these options. // This color set is readable on both black and white backgrounds. diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 30bd6c7f1..686687d80 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -308,7 +308,11 @@ private: //========================================================================== 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 > LocalObjectFiles; /* does the work for each target */