cmMessageCommand.cxx 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #include "cmMessageCommand.h"
  14. // cmLibraryCommand
  15. bool cmMessageCommand::InitialPass(std::vector<std::string> const& args)
  16. {
  17. if(args.size() < 1 )
  18. {
  19. this->SetError("called with incorrect number of arguments");
  20. return false;
  21. }
  22. std::string message;
  23. std::vector<std::string>::const_iterator i = args.begin();
  24. bool send_error = false;
  25. bool status = false;
  26. if (*i == "SEND_ERROR")
  27. {
  28. send_error = true;
  29. ++i;
  30. }
  31. else
  32. {
  33. if (*i == "STATUS")
  34. {
  35. status = true;
  36. ++i;
  37. }
  38. }
  39. for(;i != args.end(); ++i)
  40. {
  41. message += *i;
  42. }
  43. if (send_error)
  44. {
  45. cmSystemTools::Error(message.c_str());
  46. }
  47. else
  48. {
  49. if (status)
  50. {
  51. m_Makefile->DisplayStatus(message.c_str(), -1);
  52. }
  53. else
  54. {
  55. cmSystemTools::Message(message.c_str());
  56. }
  57. }
  58. return true;
  59. }