|
|
@@ -13,6 +13,8 @@
|
|
|
|
|
|
#include <sstream>
|
|
|
|
|
|
+#include "cmsys/Terminal.h"
|
|
|
+
|
|
|
MessageType cmMessenger::ConvertMessageType(MessageType t) const
|
|
|
{
|
|
|
bool warningsAsErrors;
|
|
|
@@ -85,6 +87,21 @@ static bool printMessagePreamble(MessageType t, std::ostream& msg)
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+static int getMessageColor(MessageType t)
|
|
|
+{
|
|
|
+ switch (t) {
|
|
|
+ case MessageType::INTERNAL_ERROR:
|
|
|
+ case MessageType::FATAL_ERROR:
|
|
|
+ case MessageType::AUTHOR_ERROR:
|
|
|
+ return cmsysTerminal_Color_ForegroundRed;
|
|
|
+ case MessageType::AUTHOR_WARNING:
|
|
|
+ case MessageType::WARNING:
|
|
|
+ return cmsysTerminal_Color_ForegroundYellow;
|
|
|
+ default:
|
|
|
+ return cmsysTerminal_Color_Normal;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
void printMessageText(std::ostream& msg, std::string const& text)
|
|
|
{
|
|
|
msg << ":\n";
|
|
|
@@ -122,6 +139,7 @@ void displayMessage(MessageType t, std::ostringstream& msg)
|
|
|
|
|
|
// Output the message.
|
|
|
cmMessageMetadata md;
|
|
|
+ md.desiredColor = getMessageColor(t);
|
|
|
if (t == MessageType::FATAL_ERROR || t == MessageType::INTERNAL_ERROR ||
|
|
|
t == MessageType::DEPRECATION_ERROR || t == MessageType::AUTHOR_ERROR) {
|
|
|
cmSystemTools::SetErrorOccured();
|