STYLE: Fix typo in GetFilenameLastExtension docs
[cmake.git] / Source / cmMessageCommand.cxx
blob6a0cf88207feaff7a2d39a9f658a1a6fc85686d1
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmMessageCommand.cxx,v $
5 Language: C++
6 Date: $Date: 2008-04-14 13:20:16 $
7 Version: $Revision: 1.23 $
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 bool send_error = false;
32 bool fatal_error = false;
33 bool status = false;
34 if (*i == "SEND_ERROR")
36 send_error = true;
37 ++i;
39 else
41 if (*i == "STATUS")
43 status = true;
44 ++i;
46 else
48 if (*i == "FATAL_ERROR")
50 fatal_error = true;
51 ++i;
56 for(;i != args.end(); ++i)
58 message += *i;
61 if (send_error || fatal_error)
63 this->Makefile->IssueMessage(cmake::FATAL_ERROR, message.c_str());
65 else
67 if (status)
69 this->Makefile->DisplayStatus(message.c_str(), -1);
71 else
73 cmSystemTools::Message(message.c_str());
76 if(fatal_error )
78 cmSystemTools::SetFatalErrorOccured();
80 return true;