diff options
author | Alex Neundorf <neundorf@kde.org> | 2011-08-14 14:43:04 (GMT) |
---|---|---|
committer | Alex Neundorf <neundorf@kde.org> | 2011-08-14 14:43:04 (GMT) |
commit | ddb517d014bf2245b38a0b56c9b7e98e6aaf7988 (patch) | |
tree | b5f993bd3199ff03395ce126dab4483c0a278bc3 /Source | |
parent | 93032953afb5bd939dceb3ce427f4b6fa50e2450 (diff) | |
download | CMake-ddb517d014bf2245b38a0b56c9b7e98e6aaf7988.zip CMake-ddb517d014bf2245b38a0b56c9b7e98e6aaf7988.tar.gz CMake-ddb517d014bf2245b38a0b56c9b7e98e6aaf7988.tar.bz2 |
Color output when running moc
Alex
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmQtAutomoc.cxx | 30 | ||||
-rw-r--r-- | Source/cmQtAutomoc.h | 1 |
2 files changed, 23 insertions, 8 deletions
diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx index 2add7c0..6e8c77e 100644 --- a/Source/cmQtAutomoc.cxx +++ b/Source/cmQtAutomoc.cxx @@ -4,14 +4,31 @@ #include "cmSourceFile.h" #include "cmSystemTools.h" +# include <cmsys/Terminal.h> + #include "cmQtAutomoc.h" cmQtAutomoc::cmQtAutomoc() :Verbose(cmsys::SystemTools::GetEnv("VERBOSE") != 0) +,ColorOutput(true) ,RunMocFailed(false) ,GenerateAll(false) { + + std::string colorEnv = ""; + cmsys::SystemTools::GetEnv("COLOR", colorEnv); + if(!colorEnv.empty()) + { + if(cmSystemTools::IsOn(colorEnv.c_str())) + { + this->ColorOutput = true; + } + else + { + this->ColorOutput = false; + } + } } @@ -678,14 +695,11 @@ bool cmQtAutomoc::GenerateMoc(const std::string& sourceFile, cmsys::SystemTools::MakeDirectory(mocDir.c_str()); } -/* if (this->Verbose) - { - echoColor("Generating " + mocFilePath + " from " + sourceFile); - } - else - { - echoColor("Generating " + mocFileName); - }*/ + std::string msg = "Generating "; + msg += mocFileName; + cmSystemTools::MakefileColorEcho(cmsysTerminal_Color_ForegroundBlue + |cmsysTerminal_Color_ForegroundBold, + msg.c_str(), true, this->ColorOutput); std::vector<cmStdString> command; command.push_back(this->MocExecutable); diff --git a/Source/cmQtAutomoc.h b/Source/cmQtAutomoc.h index edb66f0..af77366 100644 --- a/Source/cmQtAutomoc.h +++ b/Source/cmQtAutomoc.h @@ -61,6 +61,7 @@ private: std::list<std::string> MocDefinitions; bool Verbose; + bool ColorOutput; bool RunMocFailed; bool GenerateAll; |