cmMessageCommand.cxx 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 fatal_error = false;
  26. bool status = false;
  27. if (*i == "SEND_ERROR")
  28. {
  29. send_error = true;
  30. ++i;
  31. }
  32. else
  33. {
  34. if (*i == "STATUS")
  35. {
  36. status = true;
  37. ++i;
  38. }
  39. else
  40. {
  41. if (*i == "FATAL_ERROR")
  42. {
  43. fatal_error = true;
  44. ++i;
  45. }
  46. }
  47. }
  48. for(;i != args.end(); ++i)
  49. {
  50. message += *i;
  51. }
  52. if (send_error || fatal_error)
  53. {
  54. //cmSystemTools::Error(message.c_str());
  55. this->SetError(message.c_str());
  56. }
  57. else
  58. {
  59. if (status)
  60. {
  61. this->Makefile->DisplayStatus(message.c_str(), -1);
  62. }
  63. else
  64. {
  65. cmSystemTools::Message(message.c_str());
  66. }
  67. }
  68. if(fatal_error )
  69. {
  70. cmSystemTools::SetFatalErrorOccured();
  71. }
  72. return (!send_error && !fatal_error);
  73. }