2016-09-27 22:01:08 +03:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2001-06-05 00:55:11 +04:00
|
|
|
#include "cmMessageCommand.h"
|
|
|
|
|
2016-01-29 00:10:27 +03:00
|
|
|
#include "cmMessenger.h"
|
|
|
|
|
2001-06-05 00:55:11 +04:00
|
|
|
// cmLibraryCommand
|
2016-05-16 17:34:04 +03:00
|
|
|
bool cmMessageCommand::InitialPass(std::vector<std::string> const& args,
|
|
|
|
cmExecutionStatus&)
|
2001-06-05 00:55:11 +04:00
|
|
|
{
|
2016-09-16 00:59:29 +03:00
|
|
|
if (args.empty()) {
|
2001-06-05 00:55:11 +04:00
|
|
|
this->SetError("called with incorrect number of arguments");
|
|
|
|
return false;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2001-11-07 20:23:27 +03:00
|
|
|
std::vector<std::string>::const_iterator i = args.begin();
|
2002-03-29 18:56:07 +03:00
|
|
|
|
2009-03-06 18:04:06 +03:00
|
|
|
cmake::MessageType type = cmake::MESSAGE;
|
2002-11-13 23:59:40 +03:00
|
|
|
bool status = false;
|
2009-03-06 20:06:43 +03:00
|
|
|
bool fatal = false;
|
2016-05-16 17:34:04 +03:00
|
|
|
if (*i == "SEND_ERROR") {
|
2009-03-06 18:04:06 +03:00
|
|
|
type = cmake::FATAL_ERROR;
|
2002-03-29 18:56:07 +03:00
|
|
|
++i;
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (*i == "FATAL_ERROR") {
|
2009-03-06 20:06:43 +03:00
|
|
|
fatal = true;
|
|
|
|
type = cmake::FATAL_ERROR;
|
|
|
|
++i;
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (*i == "WARNING") {
|
2009-03-06 18:04:06 +03:00
|
|
|
type = cmake::WARNING;
|
|
|
|
++i;
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (*i == "AUTHOR_WARNING") {
|
2016-06-12 19:38:33 +03:00
|
|
|
if (this->Makefile->IsSet("CMAKE_SUPPRESS_DEVELOPER_ERRORS") &&
|
|
|
|
!this->Makefile->IsOn("CMAKE_SUPPRESS_DEVELOPER_ERRORS")) {
|
2015-12-22 00:39:27 +03:00
|
|
|
fatal = true;
|
|
|
|
type = cmake::AUTHOR_ERROR;
|
2016-06-12 19:38:33 +03:00
|
|
|
} else if (!this->Makefile->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS")) {
|
2015-11-08 15:20:47 +03:00
|
|
|
type = cmake::AUTHOR_WARNING;
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2015-12-22 00:39:27 +03:00
|
|
|
return true;
|
2009-03-06 18:04:06 +03:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
++i;
|
|
|
|
} else if (*i == "STATUS") {
|
2009-03-06 18:04:06 +03:00
|
|
|
status = true;
|
|
|
|
++i;
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (*i == "DEPRECATION") {
|
2016-06-12 19:38:33 +03:00
|
|
|
if (this->Makefile->IsOn("CMAKE_ERROR_DEPRECATED")) {
|
2013-09-17 20:54:34 +04:00
|
|
|
fatal = true;
|
|
|
|
type = cmake::DEPRECATION_ERROR;
|
2016-06-12 19:38:33 +03:00
|
|
|
} else if ((!this->Makefile->IsSet("CMAKE_WARN_DEPRECATED") ||
|
|
|
|
this->Makefile->IsOn("CMAKE_WARN_DEPRECATED"))) {
|
2015-12-22 00:39:27 +03:00
|
|
|
type = cmake::DEPRECATION_WARNING;
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2015-12-22 00:39:27 +03:00
|
|
|
return true;
|
2013-09-17 20:54:34 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
++i;
|
|
|
|
}
|
2002-03-29 18:56:07 +03:00
|
|
|
|
2015-07-18 11:45:18 +03:00
|
|
|
std::string message = cmJoin(cmMakeRange(i, args.end()), std::string());
|
2002-03-29 18:56:07 +03:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (type != cmake::MESSAGE) {
|
2016-06-09 10:57:47 +03:00
|
|
|
// we've overriden the message type, above, so display it directly
|
2016-01-29 00:10:27 +03:00
|
|
|
cmMessenger* m = this->Makefile->GetMessenger();
|
|
|
|
m->DisplayMessage(type, message, this->Makefile->GetBacktrace());
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
|
|
|
if (status) {
|
2006-06-22 23:37:58 +04:00
|
|
|
this->Makefile->DisplayStatus(message.c_str(), -1);
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2006-06-22 23:37:58 +04:00
|
|
|
cmSystemTools::Message(message.c_str());
|
2002-03-29 18:56:07 +03:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (fatal) {
|
2009-03-06 20:06:43 +03:00
|
|
|
cmSystemTools::SetFatalErrorOccured();
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2006-10-06 19:11:59 +04:00
|
|
|
return true;
|
2001-06-05 00:55:11 +04:00
|
|
|
}
|