diff options
Diffstat (limited to 'Source/cmakemain.cxx')
-rw-r--r-- | Source/cmakemain.cxx | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 997d855..d83183f 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -6,6 +6,7 @@ #include <algorithm> #include <cassert> #include <climits> +#include <cstdio> #include <cstring> #include <iostream> #include <sstream> @@ -23,6 +24,7 @@ #include "cmDocumentationEntry.h" // IWYU pragma: keep #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmMessageMetadata.h" #include "cmProperty.h" #include "cmState.h" #include "cmStateTypes.h" @@ -37,6 +39,7 @@ #endif #include "cmsys/Encoding.hxx" +#include "cmsys/Terminal.h" namespace { #ifndef CMAKE_BOOTSTRAP @@ -147,10 +150,12 @@ std::string cmakemainGetStack(cmake* cm) return msg; } -void cmakemainMessageCallback(const std::string& m, const char* /*unused*/, - cmake* cm) +void cmakemainMessageCallback(const std::string& m, + const cmMessageMetadata& md, cmake* cm) { - std::cerr << m << cmakemainGetStack(cm) << std::endl; + cmsysTerminal_cfprintf(md.desiredColor, stderr, "%s", m.c_str()); + fflush(stderr); // stderr is buffered in some cases. + std::cerr << cmakemainGetStack(cm) << "\n"; } void cmakemainProgressCallback(const std::string& m, float prog, cmake* cm) @@ -343,8 +348,8 @@ int do_cmake(int ac, char const* const* av) cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); cmSystemTools::SetMessageCallback( - [&cm](const std::string& msg, const char* title) { - cmakemainMessageCallback(msg, title, &cm); + [&cm](const std::string& msg, const cmMessageMetadata& md) { + cmakemainMessageCallback(msg, md, &cm); }); cm.SetProgressCallback([&cm](const std::string& msg, float prog) { cmakemainProgressCallback(msg, prog, &cm); @@ -626,8 +631,8 @@ int do_build(int ac, char const* const* av) cmake cm(cmake::RoleInternal, cmState::Project); cmSystemTools::SetMessageCallback( - [&cm](const std::string& msg, const char* title) { - cmakemainMessageCallback(msg, title, &cm); + [&cm](const std::string& msg, const cmMessageMetadata& md) { + cmakemainMessageCallback(msg, md, &cm); }); cm.SetProgressCallback([&cm](const std::string& msg, float prog) { cmakemainProgressCallback(msg, prog, &cm); @@ -859,8 +864,8 @@ int do_install(int ac, char const* const* av) cmake cm(cmake::RoleScript, cmState::Script); cmSystemTools::SetMessageCallback( - [&cm](const std::string& msg, const char* title) { - cmakemainMessageCallback(msg, title, &cm); + [&cm](const std::string& msg, const cmMessageMetadata& md) { + cmakemainMessageCallback(msg, md, &cm); }); cm.SetProgressCallback([&cm](const std::string& msg, float prog) { cmakemainProgressCallback(msg, prog, &cm); @@ -940,8 +945,8 @@ int do_open(int ac, char const* const* av) cmake cm(cmake::RoleInternal, cmState::Unknown); cmSystemTools::SetMessageCallback( - [&cm](const std::string& msg, const char* title) { - cmakemainMessageCallback(msg, title, &cm); + [&cm](const std::string& msg, const cmMessageMetadata& md) { + cmakemainMessageCallback(msg, md, &cm); }); cm.SetProgressCallback([&cm](const std::string& msg, float prog) { cmakemainProgressCallback(msg, prog, &cm); |