Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Source / cmMessageCommand.cxx
blob8462f4d73c6994ee2e2cab5f253db090cd77a673
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmMessageCommand.cxx,v $
5 Language: C++
6 Date: $Date: 2009-03-06 17:06:41 $
7 Version: $Revision: 1.25 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #include "cmMessageCommand.h"
19 // cmLibraryCommand
20 bool cmMessageCommand
21 ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
23 if(args.size() < 1 )
25 this->SetError("called with incorrect number of arguments");
26 return false;
28 std::string message;
29 std::vector<std::string>::const_iterator i = args.begin();
31 cmake::MessageType type = cmake::MESSAGE;
32 bool status = false;
33 bool fatal = false;
34 if (*i == "SEND_ERROR")
36 type = cmake::FATAL_ERROR;
37 ++i;
39 else if (*i == "FATAL_ERROR")
41 fatal = true;
42 type = cmake::FATAL_ERROR;
43 ++i;
45 else if (*i == "WARNING")
47 type = cmake::WARNING;
48 ++i;
50 else if (*i == "AUTHOR_WARNING")
52 type = cmake::AUTHOR_WARNING;
53 ++i;
55 else if (*i == "STATUS")
57 status = true;
58 ++i;
61 for(;i != args.end(); ++i)
63 message += *i;
66 if (type != cmake::MESSAGE)
68 this->Makefile->IssueMessage(type, message.c_str());
70 else
72 if (status)
74 this->Makefile->DisplayStatus(message.c_str(), -1);
76 else
78 cmSystemTools::Message(message.c_str());
81 if(fatal)
83 cmSystemTools::SetFatalErrorOccured();
85 return true;