From b6ebd7b7faae86140fb711dac1f96e2dd047ecd9 Mon Sep 17 00:00:00 2001 From: Sebastien Barre Date: Fri, 29 Mar 2002 10:56:07 -0500 Subject: [PATCH] ENH: Add SEND_ERROR flag to MESSAGE so that an error can be raised within a CMakeList file --- Source/cmMessageCommand.cxx | 20 +++++++++++++++++++- Source/cmMessageCommand.h | 4 ++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx index f1ade11bd..0cb2661fd 100644 --- a/Source/cmMessageCommand.cxx +++ b/Source/cmMessageCommand.cxx @@ -25,13 +25,31 @@ bool cmMessageCommand::InitialPass(std::vector const& args) this->SetError("called with incorrect number of arguments"); return false; } + std::string message; std::vector::const_iterator i = args.begin(); + + bool send_error = false; + if (*i == "SEND_ERROR") + { + send_error = true; + ++i; + } + for(;i != args.end(); ++i) { message += *i; } - cmSystemTools::Message(message.c_str()); + + if (send_error) + { + cmSystemTools::Error(message.c_str()); + } + else + { + cmSystemTools::Message(message.c_str()); + } + return true; } diff --git a/Source/cmMessageCommand.h b/Source/cmMessageCommand.h index 6a0403da0..ca1926431 100644 --- a/Source/cmMessageCommand.h +++ b/Source/cmMessageCommand.h @@ -60,8 +60,8 @@ public: virtual const char* GetFullDocumentation() { return - "MESSAGE(\"the message to display\" \"Title for dialog\")\n" - "The first argument is the message to display. The second argument is optional and is the title for the dialog box on windows."; + "MESSAGE([SEND_ERROR] \"message to display\"...)\n" + "The arguments are messages to display. If the first argument is SEND_ERROR then an error is raised."; } cmTypeMacro(cmMessageCommand, cmCommand);