From 69ac6d27555cd4819d0c7f40e4471c6f885e23ab Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 5 Feb 2015 16:29:59 -0500 Subject: [PATCH] bootstrap: Enable color Makefile output Build the needed infrastructure during bootstrap in order to allow "cmake -E cmake_echo_color" to be used unconditionally during generation. --- Source/cmLocalUnixMakefileGenerator3.cxx | 10 +--------- Source/cmSystemTools.cxx | 4 +--- Source/cmSystemTools.h | 2 -- Source/cmcmd.cxx | 11 ++--------- bootstrap | 9 ++++++--- 5 files changed, 10 insertions(+), 26 deletions(-) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index fbf214036..72d4ef072 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -27,10 +27,10 @@ #ifdef CMAKE_BUILD_WITH_CMAKE # include "cmDependsFortran.h" # include "cmDependsJava.h" -# include #endif #include +#include #include @@ -1351,7 +1351,6 @@ 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->ColorMakefile) { // See cmake::ExecuteEchoColor in cmake.cxx for these options. @@ -1377,9 +1376,6 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector& commands, break; } } -#else - (void)color; -#endif // Echo one line at a time. std::string line; @@ -1617,14 +1613,10 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo, targetName = targetName.substr(0, targetName.length()-4); std::string message = "Scanning dependencies of target "; message += targetName; -#ifdef CMAKE_BUILD_WITH_CMAKE cmSystemTools::MakefileColorEcho( cmsysTerminal_Color_ForegroundMagenta | cmsysTerminal_Color_ForegroundBold, message.c_str(), true, color); -#else - fprintf(stdout, "%s\n", message.c_str()); -#endif return this->ScanDependencies(dir.c_str(), validDependencies); } diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index e9735ed41..ec3d846c3 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -27,10 +27,10 @@ #if defined(CMAKE_BUILD_WITH_CMAKE) # include "cmArchiveWrite.h" # include -# include #endif #include #include +#include #if defined(_WIN32) # include @@ -2284,7 +2284,6 @@ std::string const& cmSystemTools::GetCMakeRoot() } //---------------------------------------------------------------------------- -#if defined(CMAKE_BUILD_WITH_CMAKE) void cmSystemTools::MakefileColorEcho(int color, const char* message, bool newline, bool enabled) { @@ -2314,7 +2313,6 @@ void cmSystemTools::MakefileColorEcho(int color, const char* message, fprintf(stdout, "%s%s", message, newline? "\n" : ""); } } -#endif //---------------------------------------------------------------------------- bool cmSystemTools::GuessLibrarySOName(std::string const& fullPath, diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 361f42e60..c59ae96b8 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -428,11 +428,9 @@ public: static std::string const& GetCMakeCursesCommand(); static std::string const& GetCMakeRoot(); -#if defined(CMAKE_BUILD_WITH_CMAKE) /** Echo a message in color using KWSys's Terminal cprintf. */ static void MakefileColorEcho(int color, const char* message, bool newLine, bool enabled); -#endif /** Try to guess the soname of a shared library. */ static bool GuessLibrarySOName(std::string const& fullPath, diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 28fcd27f7..6b04d260e 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -18,12 +18,12 @@ #if defined(CMAKE_BUILD_WITH_CMAKE) # include "cmDependsFortran.h" // For -E cmake_copy_f90_mod callback. -# include #endif #include #include #include +#include #if defined(CMAKE_HAVE_VS_GENERATORS) #include "cmCallVisualStudioMacro.h" @@ -753,12 +753,12 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) { return cmcmd::VisualStudioLink(args, 2); } -#ifdef CMAKE_BUILD_WITH_CMAKE // Internal CMake color makefile support. else if (args[1] == "cmake_echo_color") { return cmcmd::ExecuteEchoColor(args); } +#ifdef CMAKE_BUILD_WITH_CMAKE else if (args[1] == "cmake_autogen" && args.size() >= 4) { cmQtAutoGenerators autogen; @@ -987,7 +987,6 @@ bool cmcmd::SymlinkInternal(std::string const& file, std::string const& link) } //---------------------------------------------------------------------------- -#ifdef CMAKE_BUILD_WITH_CMAKE int cmcmd::ExecuteEchoColor(std::vector& args) { // The arguments are @@ -1073,12 +1072,6 @@ int cmcmd::ExecuteEchoColor(std::vector& args) return 0; } -#else -int cmcmd::ExecuteEchoColor(std::vector&) -{ - return 1; -} -#endif //---------------------------------------------------------------------------- int cmcmd::ExecuteLinkScript(std::vector& args) diff --git a/bootstrap b/bootstrap index a88eb6a1c..8e22bee9e 100755 --- a/bootstrap +++ b/bootstrap @@ -333,13 +333,15 @@ if ${cmake_system_mingw}; then EncodingC \ ProcessWin32 \ String \ - System" + System \ + Terminal" else KWSYS_C_SOURCES="\ EncodingC \ ProcessUNIX \ String \ - System" + System \ + Terminal" fi KWSYS_CXX_SOURCES="\ @@ -362,7 +364,8 @@ KWSYS_FILES="\ String.h \ String.hxx \ System.h \ - SystemTools.hxx" + SystemTools.hxx \ + Terminal.h" KWSYS_IOS_FILES=" fstream \