cmMessageCommand.cxx 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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
  16. ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
  17. {
  18. if(args.size() < 1 )
  19. {
  20. this->SetError("called with incorrect number of arguments");
  21. return false;
  22. }
  23. std::string message;
  24. std::vector<std::string>::const_iterator i = args.begin();
  25. cmake::MessageType type = cmake::MESSAGE;
  26. bool status = false;
  27. if (*i == "SEND_ERROR" || *i == "FATAL_ERROR")
  28. {
  29. type = cmake::FATAL_ERROR;
  30. ++i;
  31. }
  32. else if (*i == "WARNING")
  33. {
  34. type = cmake::WARNING;
  35. ++i;
  36. }
  37. else if (*i == "AUTHOR_WARNING")
  38. {
  39. type = cmake::AUTHOR_WARNING;
  40. ++i;
  41. }
  42. else if (*i == "STATUS")
  43. {
  44. status = true;
  45. ++i;
  46. }
  47. for(;i != args.end(); ++i)
  48. {
  49. message += *i;
  50. }
  51. if (type != cmake::MESSAGE)
  52. {
  53. this->Makefile->IssueMessage(type, message.c_str());
  54. }
  55. else
  56. {
  57. if (status)
  58. {
  59. this->Makefile->DisplayStatus(message.c_str(), -1);
  60. }
  61. else
  62. {
  63. cmSystemTools::Message(message.c_str());
  64. }
  65. }
  66. return true;
  67. }