2009-09-28 11:43:28 -04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
2001-06-04 16:55:11 -04:00
|
|
|
|
2009-09-28 11:43:28 -04:00
|
|
|
Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
see accompanying file Copyright.txt for details.
|
2001-06-04 16:55:11 -04:00
|
|
|
|
2009-09-28 11:43:28 -04:00
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the License for more information.
|
|
|
|
============================================================================*/
|
2001-06-04 16:55:11 -04:00
|
|
|
#include "cmMessageCommand.h"
|
|
|
|
|
2016-01-28 22:10:27 +01:00
|
|
|
#include "cmMessenger.h"
|
|
|
|
|
2001-06-04 16:55:11 -04:00
|
|
|
// cmLibraryCommand
|
2016-05-16 10:34:04 -04:00
|
|
|
bool cmMessageCommand::InitialPass(std::vector<std::string> const& args,
|
|
|
|
cmExecutionStatus&)
|
2001-06-04 16:55:11 -04:00
|
|
|
{
|
2016-05-16 10:34:04 -04:00
|
|
|
if (args.size() < 1) {
|
2001-06-04 16:55:11 -04:00
|
|
|
this->SetError("called with incorrect number of arguments");
|
|
|
|
return false;
|
2016-05-16 10:34:04 -04:00
|
|
|
}
|
2001-11-07 12:23:27 -05:00
|
|
|
std::vector<std::string>::const_iterator i = args.begin();
|
2002-03-29 10:56:07 -05:00
|
|
|
|
2009-03-06 10:04:06 -05:00
|
|
|
cmake::MessageType type = cmake::MESSAGE;
|
2002-11-13 15:59:40 -05:00
|
|
|
bool status = false;
|
2009-03-06 12:06:43 -05:00
|
|
|
bool fatal = false;
|
2016-05-16 10:34:04 -04:00
|
|
|
if (*i == "SEND_ERROR") {
|
2009-03-06 10:04:06 -05:00
|
|
|
type = cmake::FATAL_ERROR;
|
2002-03-29 10:56:07 -05:00
|
|
|
++i;
|
2016-05-16 10:34:04 -04:00
|
|
|
} else if (*i == "FATAL_ERROR") {
|
2009-03-06 12:06:43 -05:00
|
|
|
fatal = true;
|
|
|
|
type = cmake::FATAL_ERROR;
|
|
|
|
++i;
|
2016-05-16 10:34:04 -04:00
|
|
|
} else if (*i == "WARNING") {
|
2009-03-06 10:04:06 -05:00
|
|
|
type = cmake::WARNING;
|
|
|
|
++i;
|
2016-05-16 10:34:04 -04:00
|
|
|
} else if (*i == "AUTHOR_WARNING") {
|
2016-06-12 18:38:33 +02:00
|
|
|
if (this->Makefile->IsSet("CMAKE_SUPPRESS_DEVELOPER_ERRORS") &&
|
|
|
|
!this->Makefile->IsOn("CMAKE_SUPPRESS_DEVELOPER_ERRORS")) {
|
2015-12-21 21:39:27 +00:00
|
|
|
fatal = true;
|
|
|
|
type = cmake::AUTHOR_ERROR;
|
2016-06-12 18:38:33 +02:00
|
|
|
} else if (!this->Makefile->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS")) {
|
2015-11-08 12:20:47 +00:00
|
|
|
type = cmake::AUTHOR_WARNING;
|
2016-05-16 10:34:04 -04:00
|
|
|
} else {
|
2015-12-21 21:39:27 +00:00
|
|
|
return true;
|
2009-03-06 10:04:06 -05:00
|
|
|
}
|
2016-05-16 10:34:04 -04:00
|
|
|
++i;
|
|
|
|
} else if (*i == "STATUS") {
|
2009-03-06 10:04:06 -05:00
|
|
|
status = true;
|
|
|
|
++i;
|
2016-05-16 10:34:04 -04:00
|
|
|
} else if (*i == "DEPRECATION") {
|
2016-06-12 18:38:33 +02:00
|
|
|
if (this->Makefile->IsOn("CMAKE_ERROR_DEPRECATED")) {
|
2013-09-17 18:54:34 +02:00
|
|
|
fatal = true;
|
|
|
|
type = cmake::DEPRECATION_ERROR;
|
2016-06-12 18:38:33 +02:00
|
|
|
} else if ((!this->Makefile->IsSet("CMAKE_WARN_DEPRECATED") ||
|
|
|
|
this->Makefile->IsOn("CMAKE_WARN_DEPRECATED"))) {
|
2015-12-21 21:39:27 +00:00
|
|
|
type = cmake::DEPRECATION_WARNING;
|
2016-05-16 10:34:04 -04:00
|
|
|
} else {
|
2015-12-21 21:39:27 +00:00
|
|
|
return true;
|
2013-09-17 18:54:34 +02:00
|
|
|
}
|
2016-05-16 10:34:04 -04:00
|
|
|
++i;
|
|
|
|
}
|
2002-03-29 10:56:07 -05:00
|
|
|
|
2015-07-18 10:45:18 +02:00
|
|
|
std::string message = cmJoin(cmMakeRange(i, args.end()), std::string());
|
2002-03-29 10:56:07 -05:00
|
|
|
|
2016-05-16 10:34:04 -04:00
|
|
|
if (type != cmake::MESSAGE) {
|
2016-06-09 09:57:47 +02:00
|
|
|
// we've overriden the message type, above, so display it directly
|
2016-01-28 22:10:27 +01:00
|
|
|
cmMessenger* m = this->Makefile->GetMessenger();
|
|
|
|
m->DisplayMessage(type, message, this->Makefile->GetBacktrace());
|
2016-05-16 10:34:04 -04:00
|
|
|
} else {
|
|
|
|
if (status) {
|
2006-06-22 15:37:58 -04:00
|
|
|
this->Makefile->DisplayStatus(message.c_str(), -1);
|
2016-05-16 10:34:04 -04:00
|
|
|
} else {
|
2006-06-22 15:37:58 -04:00
|
|
|
cmSystemTools::Message(message.c_str());
|
2002-03-29 10:56:07 -05:00
|
|
|
}
|
2016-05-16 10:34:04 -04:00
|
|
|
}
|
|
|
|
if (fatal) {
|
2009-03-06 12:06:43 -05:00
|
|
|
cmSystemTools::SetFatalErrorOccured();
|
2016-05-16 10:34:04 -04:00
|
|
|
}
|
2006-10-06 11:11:59 -04:00
|
|
|
return true;
|
2001-06-04 16:55:11 -04:00
|
|
|
}
|