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.
This commit is contained in:
Brad King 2015-02-05 16:29:59 -05:00
parent 098160d5f2
commit 69ac6d2755
5 changed files with 10 additions and 26 deletions

View File

@ -27,10 +27,10 @@
#ifdef CMAKE_BUILD_WITH_CMAKE #ifdef CMAKE_BUILD_WITH_CMAKE
# include "cmDependsFortran.h" # include "cmDependsFortran.h"
# include "cmDependsJava.h" # include "cmDependsJava.h"
# include <cmsys/Terminal.h>
#endif #endif
#include <cmsys/auto_ptr.hxx> #include <cmsys/auto_ptr.hxx>
#include <cmsys/Terminal.h>
#include <queue> #include <queue>
@ -1351,7 +1351,6 @@ 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
if(this->GlobalGenerator->GetToolSupportsColor() && this->ColorMakefile) if(this->GlobalGenerator->GetToolSupportsColor() && this->ColorMakefile)
{ {
// See cmake::ExecuteEchoColor in cmake.cxx for these options. // See cmake::ExecuteEchoColor in cmake.cxx for these options.
@ -1377,9 +1376,6 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands,
break; break;
} }
} }
#else
(void)color;
#endif
// Echo one line at a time. // Echo one line at a time.
std::string line; std::string line;
@ -1617,14 +1613,10 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo,
targetName = targetName.substr(0, targetName.length()-4); targetName = targetName.substr(0, targetName.length()-4);
std::string message = "Scanning dependencies of target "; std::string message = "Scanning dependencies of target ";
message += targetName; message += targetName;
#ifdef CMAKE_BUILD_WITH_CMAKE
cmSystemTools::MakefileColorEcho( cmSystemTools::MakefileColorEcho(
cmsysTerminal_Color_ForegroundMagenta | cmsysTerminal_Color_ForegroundMagenta |
cmsysTerminal_Color_ForegroundBold, cmsysTerminal_Color_ForegroundBold,
message.c_str(), true, color); message.c_str(), true, color);
#else
fprintf(stdout, "%s\n", message.c_str());
#endif
return this->ScanDependencies(dir.c_str(), validDependencies); return this->ScanDependencies(dir.c_str(), validDependencies);
} }

View File

@ -27,10 +27,10 @@
#if defined(CMAKE_BUILD_WITH_CMAKE) #if defined(CMAKE_BUILD_WITH_CMAKE)
# include "cmArchiveWrite.h" # include "cmArchiveWrite.h"
# include <cm_libarchive.h> # include <cm_libarchive.h>
# include <cmsys/Terminal.h>
#endif #endif
#include <cmsys/stl/algorithm> #include <cmsys/stl/algorithm>
#include <cmsys/FStream.hxx> #include <cmsys/FStream.hxx>
#include <cmsys/Terminal.h>
#if defined(_WIN32) #if defined(_WIN32)
# include <windows.h> # include <windows.h>
@ -2284,7 +2284,6 @@ std::string const& cmSystemTools::GetCMakeRoot()
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
#if defined(CMAKE_BUILD_WITH_CMAKE)
void cmSystemTools::MakefileColorEcho(int color, const char* message, void cmSystemTools::MakefileColorEcho(int color, const char* message,
bool newline, bool enabled) bool newline, bool enabled)
{ {
@ -2314,7 +2313,6 @@ void cmSystemTools::MakefileColorEcho(int color, const char* message,
fprintf(stdout, "%s%s", message, newline? "\n" : ""); fprintf(stdout, "%s%s", message, newline? "\n" : "");
} }
} }
#endif
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmSystemTools::GuessLibrarySOName(std::string const& fullPath, bool cmSystemTools::GuessLibrarySOName(std::string const& fullPath,

View File

@ -428,11 +428,9 @@ public:
static std::string const& GetCMakeCursesCommand(); static std::string const& GetCMakeCursesCommand();
static std::string const& GetCMakeRoot(); static std::string const& GetCMakeRoot();
#if defined(CMAKE_BUILD_WITH_CMAKE)
/** Echo a message in color using KWSys's Terminal cprintf. */ /** Echo a message in color using KWSys's Terminal cprintf. */
static void MakefileColorEcho(int color, const char* message, static void MakefileColorEcho(int color, const char* message,
bool newLine, bool enabled); bool newLine, bool enabled);
#endif
/** Try to guess the soname of a shared library. */ /** Try to guess the soname of a shared library. */
static bool GuessLibrarySOName(std::string const& fullPath, static bool GuessLibrarySOName(std::string const& fullPath,

View File

@ -18,12 +18,12 @@
#if defined(CMAKE_BUILD_WITH_CMAKE) #if defined(CMAKE_BUILD_WITH_CMAKE)
# include "cmDependsFortran.h" // For -E cmake_copy_f90_mod callback. # include "cmDependsFortran.h" // For -E cmake_copy_f90_mod callback.
# include <cmsys/Terminal.h>
#endif #endif
#include <cmsys/Directory.hxx> #include <cmsys/Directory.hxx>
#include <cmsys/Process.h> #include <cmsys/Process.h>
#include <cmsys/FStream.hxx> #include <cmsys/FStream.hxx>
#include <cmsys/Terminal.h>
#if defined(CMAKE_HAVE_VS_GENERATORS) #if defined(CMAKE_HAVE_VS_GENERATORS)
#include "cmCallVisualStudioMacro.h" #include "cmCallVisualStudioMacro.h"
@ -753,12 +753,12 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
{ {
return cmcmd::VisualStudioLink(args, 2); return cmcmd::VisualStudioLink(args, 2);
} }
#ifdef CMAKE_BUILD_WITH_CMAKE
// Internal CMake color makefile support. // Internal CMake color makefile support.
else if (args[1] == "cmake_echo_color") else if (args[1] == "cmake_echo_color")
{ {
return cmcmd::ExecuteEchoColor(args); return cmcmd::ExecuteEchoColor(args);
} }
#ifdef CMAKE_BUILD_WITH_CMAKE
else if (args[1] == "cmake_autogen" && args.size() >= 4) else if (args[1] == "cmake_autogen" && args.size() >= 4)
{ {
cmQtAutoGenerators autogen; 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<std::string>& args) int cmcmd::ExecuteEchoColor(std::vector<std::string>& args)
{ {
// The arguments are // The arguments are
@ -1073,12 +1072,6 @@ int cmcmd::ExecuteEchoColor(std::vector<std::string>& args)
return 0; return 0;
} }
#else
int cmcmd::ExecuteEchoColor(std::vector<std::string>&)
{
return 1;
}
#endif
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int cmcmd::ExecuteLinkScript(std::vector<std::string>& args) int cmcmd::ExecuteLinkScript(std::vector<std::string>& args)

View File

@ -333,13 +333,15 @@ if ${cmake_system_mingw}; then
EncodingC \ EncodingC \
ProcessWin32 \ ProcessWin32 \
String \ String \
System" System \
Terminal"
else else
KWSYS_C_SOURCES="\ KWSYS_C_SOURCES="\
EncodingC \ EncodingC \
ProcessUNIX \ ProcessUNIX \
String \ String \
System" System \
Terminal"
fi fi
KWSYS_CXX_SOURCES="\ KWSYS_CXX_SOURCES="\
@ -362,7 +364,8 @@ KWSYS_FILES="\
String.h \ String.h \
String.hxx \ String.hxx \
System.h \ System.h \
SystemTools.hxx" SystemTools.hxx \
Terminal.h"
KWSYS_IOS_FILES=" KWSYS_IOS_FILES="
fstream \ fstream \