|
@@ -8,6 +8,9 @@
|
|
|
#include "cmMessenger.h"
|
|
#include "cmMessenger.h"
|
|
|
#include "cmRange.h"
|
|
#include "cmRange.h"
|
|
|
#include "cmSystemTools.h"
|
|
#include "cmSystemTools.h"
|
|
|
|
|
+#include "cmake.h"
|
|
|
|
|
+
|
|
|
|
|
+#include <cassert>
|
|
|
|
|
|
|
|
class cmExecutionStatus;
|
|
class cmExecutionStatus;
|
|
|
|
|
|
|
@@ -24,41 +27,80 @@ bool cmMessageCommand::InitialPass(std::vector<std::string> const& args,
|
|
|
MessageType type = MessageType::MESSAGE;
|
|
MessageType type = MessageType::MESSAGE;
|
|
|
bool status = false;
|
|
bool status = false;
|
|
|
bool fatal = false;
|
|
bool fatal = false;
|
|
|
|
|
+ auto level = cmake::LogLevel::LOG_UNDEFINED;
|
|
|
if (*i == "SEND_ERROR") {
|
|
if (*i == "SEND_ERROR") {
|
|
|
type = MessageType::FATAL_ERROR;
|
|
type = MessageType::FATAL_ERROR;
|
|
|
|
|
+ level = cmake::LogLevel::LOG_ERROR;
|
|
|
++i;
|
|
++i;
|
|
|
} else if (*i == "FATAL_ERROR") {
|
|
} else if (*i == "FATAL_ERROR") {
|
|
|
fatal = true;
|
|
fatal = true;
|
|
|
type = MessageType::FATAL_ERROR;
|
|
type = MessageType::FATAL_ERROR;
|
|
|
|
|
+ level = cmake::LogLevel::LOG_ERROR;
|
|
|
++i;
|
|
++i;
|
|
|
} else if (*i == "WARNING") {
|
|
} else if (*i == "WARNING") {
|
|
|
type = MessageType::WARNING;
|
|
type = MessageType::WARNING;
|
|
|
|
|
+ level = cmake::LogLevel::LOG_WARNING;
|
|
|
++i;
|
|
++i;
|
|
|
} else if (*i == "AUTHOR_WARNING") {
|
|
} else if (*i == "AUTHOR_WARNING") {
|
|
|
if (this->Makefile->IsSet("CMAKE_SUPPRESS_DEVELOPER_ERRORS") &&
|
|
if (this->Makefile->IsSet("CMAKE_SUPPRESS_DEVELOPER_ERRORS") &&
|
|
|
!this->Makefile->IsOn("CMAKE_SUPPRESS_DEVELOPER_ERRORS")) {
|
|
!this->Makefile->IsOn("CMAKE_SUPPRESS_DEVELOPER_ERRORS")) {
|
|
|
fatal = true;
|
|
fatal = true;
|
|
|
type = MessageType::AUTHOR_ERROR;
|
|
type = MessageType::AUTHOR_ERROR;
|
|
|
|
|
+ level = cmake::LogLevel::LOG_ERROR;
|
|
|
} else if (!this->Makefile->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS")) {
|
|
} else if (!this->Makefile->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS")) {
|
|
|
type = MessageType::AUTHOR_WARNING;
|
|
type = MessageType::AUTHOR_WARNING;
|
|
|
|
|
+ level = cmake::LogLevel::LOG_WARNING;
|
|
|
} else {
|
|
} else {
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
++i;
|
|
++i;
|
|
|
} else if (*i == "STATUS") {
|
|
} else if (*i == "STATUS") {
|
|
|
status = true;
|
|
status = true;
|
|
|
|
|
+ level = cmake::LogLevel::LOG_STATUS;
|
|
|
|
|
+ ++i;
|
|
|
|
|
+ } else if (*i == "VERBOSE") {
|
|
|
|
|
+ status = true;
|
|
|
|
|
+ level = cmake::LogLevel::LOG_VERBOSE;
|
|
|
|
|
+ ++i;
|
|
|
|
|
+ } else if (*i == "DEBUG") {
|
|
|
|
|
+ status = true;
|
|
|
|
|
+ level = cmake::LogLevel::LOG_DEBUG;
|
|
|
|
|
+ ++i;
|
|
|
|
|
+ } else if (*i == "TRACE") {
|
|
|
|
|
+ status = true;
|
|
|
|
|
+ level = cmake::LogLevel::LOG_TRACE;
|
|
|
++i;
|
|
++i;
|
|
|
} else if (*i == "DEPRECATION") {
|
|
} else if (*i == "DEPRECATION") {
|
|
|
if (this->Makefile->IsOn("CMAKE_ERROR_DEPRECATED")) {
|
|
if (this->Makefile->IsOn("CMAKE_ERROR_DEPRECATED")) {
|
|
|
fatal = true;
|
|
fatal = true;
|
|
|
type = MessageType::DEPRECATION_ERROR;
|
|
type = MessageType::DEPRECATION_ERROR;
|
|
|
|
|
+ level = cmake::LogLevel::LOG_ERROR;
|
|
|
} else if ((!this->Makefile->IsSet("CMAKE_WARN_DEPRECATED") ||
|
|
} else if ((!this->Makefile->IsSet("CMAKE_WARN_DEPRECATED") ||
|
|
|
this->Makefile->IsOn("CMAKE_WARN_DEPRECATED"))) {
|
|
this->Makefile->IsOn("CMAKE_WARN_DEPRECATED"))) {
|
|
|
type = MessageType::DEPRECATION_WARNING;
|
|
type = MessageType::DEPRECATION_WARNING;
|
|
|
|
|
+ level = cmake::LogLevel::LOG_WARNING;
|
|
|
} else {
|
|
} else {
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
++i;
|
|
++i;
|
|
|
|
|
+ } else if (*i == "NOTICE") {
|
|
|
|
|
+ // `NOTICE` message type is going to be output to stderr
|
|
|
|
|
+ level = cmake::LogLevel::LOG_NOTICE;
|
|
|
|
|
+ ++i;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // Messages w/o any type are `NOTICE`s
|
|
|
|
|
+ level = cmake::LogLevel::LOG_NOTICE;
|
|
|
|
|
+ }
|
|
|
|
|
+ assert("Message log level expected to be set" &&
|
|
|
|
|
+ level != cmake::LogLevel::LOG_UNDEFINED);
|
|
|
|
|
+
|
|
|
|
|
+ auto desiredLevel = this->Makefile->GetCMakeInstance()->GetLogLevel();
|
|
|
|
|
+ assert("Expected a valid log level here" &&
|
|
|
|
|
+ desiredLevel != cmake::LogLevel::LOG_UNDEFINED);
|
|
|
|
|
+
|
|
|
|
|
+ if (desiredLevel < level) {
|
|
|
|
|
+ // Suppress the message
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
std::string message = cmJoin(cmMakeRange(i, args.end()), std::string());
|
|
std::string message = cmJoin(cmMakeRange(i, args.end()), std::string());
|