summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-03-06 10:04:06 -0500
committerBrad King <brad.king@kitware.com>2009-03-06 10:04:06 -0500
commitca3b93d9c6a816afd7a07bf218c8884510219cf4 (patch)
treef88d3af0bdb2bb57b17cb737e762901317593dd4 /Source
parent62702551dbf77632f566c92aa2c2555f23fe1557 (diff)
downloadcmake-ca3b93d9c6a816afd7a07bf218c8884510219cf4.tar.gz
ENH: Teach message() how to display warnings
This adds message(WARNING) and message(AUTHOR_WARNING) command modes and fully documents the command behavior in all modes.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmMessageCommand.cxx42
-rw-r--r--Source/cmMessageCommand.h30
2 files changed, 39 insertions, 33 deletions
diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx
index a6f5808b6f..7e66e05dba 100644
--- a/Source/cmMessageCommand.cxx
+++ b/Source/cmMessageCommand.cxx
@@ -28,29 +28,27 @@ bool cmMessageCommand
std::string message;
std::vector<std::string>::const_iterator i = args.begin();
- bool send_error = false;
- bool fatal_error = false;
+ cmake::MessageType type = cmake::MESSAGE;
bool status = false;
- if (*i == "SEND_ERROR")
+ if (*i == "SEND_ERROR" || *i == "FATAL_ERROR")
{
- send_error = true;
+ type = cmake::FATAL_ERROR;
++i;
}
- else
+ else if (*i == "WARNING")
{
- if (*i == "STATUS")
- {
- status = true;
- ++i;
- }
- else
- {
- if (*i == "FATAL_ERROR")
- {
- fatal_error = true;
- ++i;
- }
- }
+ type = cmake::WARNING;
+ ++i;
+ }
+ else if (*i == "AUTHOR_WARNING")
+ {
+ type = cmake::AUTHOR_WARNING;
+ ++i;
+ }
+ else if (*i == "STATUS")
+ {
+ status = true;
+ ++i;
}
for(;i != args.end(); ++i)
@@ -58,9 +56,9 @@ bool cmMessageCommand
message += *i;
}
- if (send_error || fatal_error)
+ if (type != cmake::MESSAGE)
{
- this->Makefile->IssueMessage(cmake::FATAL_ERROR, message.c_str());
+ this->Makefile->IssueMessage(type, message.c_str());
}
else
{
@@ -73,10 +71,6 @@ bool cmMessageCommand
cmSystemTools::Message(message.c_str());
}
}
- if(fatal_error )
- {
- cmSystemTools::SetFatalErrorOccured();
- }
return true;
}
diff --git a/Source/cmMessageCommand.h b/Source/cmMessageCommand.h
index 54cccd4369..f2496f48d0 100644
--- a/Source/cmMessageCommand.h
+++ b/Source/cmMessageCommand.h
@@ -65,16 +65,28 @@ public:
virtual const char* GetFullDocumentation()
{
return
- " message([SEND_ERROR | STATUS | FATAL_ERROR]\n"
+ " message([STATUS|WARNING|AUTHOR_WARNING|FATAL_ERROR|SEND_ERROR]\n"
" \"message to display\" ...)\n"
- "By default the message is displayed in a pop up window (CMakeSetup), "
- "or in the stdout of cmake, or the error section of ccmake. "
- "If the first argument is "
- "SEND_ERROR then an error is raised, and the generate phase will "
- "be skipped. If the first argument is FATAL_ERROR, all processing "
- "is halted. If the first argument is STATUS then the message is "
- "displayed in the progress line for the GUI, or with a -- in the "
- "command line cmake.";
+ "The optional keyword determines the type of message:\n"
+ " (none) = Important information\n"
+ " STATUS = Incidental information\n"
+ " WARNING = CMake Warning, continue processing\n"
+ " AUTHOR_WARNING = CMake Warning (dev), continue processing\n"
+ " FATAL_ERROR = CMake Error, stop all processing\n"
+ " SEND_ERROR = CMake Error, stop all processing (legacy)\n"
+ "The CMake command-line tool displays STATUS messages on stdout "
+ "and all other message types on stderr. "
+ "The CMake GUI displays all messages in its log area. "
+ "The interactive dialogs (ccmake and CMakeSetup) show STATUS messages "
+ "one at a time on a status line and other messages in interactive "
+ "pop-up boxes."
+ "\n"
+ "CMake Warning and Error message text displays using a simple "
+ "markup language. "
+ "Non-indented text is formatted in line-wrapped paragraphs delimited "
+ "by newlines. "
+ "Indented text is considered pre-formatted."
+ ;
}
cmTypeMacro(cmMessageCommand, cmCommand);