cmMessageCommand.cxx 1.6 KB

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