cmCustomCommand.cxx 2.0 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 "cmCustomCommand.h"
  14. #include "cmMakefile.h"
  15. /**
  16. * The constructor
  17. */
  18. cmCustomCommand::cmCustomCommand(const char *command,
  19. const char* arguments,
  20. std::vector<std::string> dep,
  21. const char *out):
  22. m_Command(command),
  23. m_Arguments(arguments),
  24. m_Depends(dep)
  25. {
  26. if (out)
  27. {
  28. m_Output = out;
  29. }
  30. }
  31. cmCustomCommand::cmCustomCommand(const char *command,
  32. const char* arguments):
  33. m_Command(command),
  34. m_Arguments(arguments)
  35. {
  36. }
  37. /**
  38. * Copy constructor.
  39. */
  40. cmCustomCommand::cmCustomCommand(const cmCustomCommand& r):
  41. m_Command(r.m_Command),
  42. m_Arguments(r.m_Arguments),
  43. m_Comment(r.m_Comment),
  44. m_Output(r.m_Output),
  45. m_Depends(r.m_Depends)
  46. {
  47. }
  48. void cmCustomCommand::ExpandVariables(const cmMakefile &mf)
  49. {
  50. mf.ExpandVariablesInString(m_Command);
  51. mf.ExpandVariablesInString(m_Arguments);
  52. mf.ExpandVariablesInString(m_Output);
  53. for (std::vector<std::string>::iterator i = m_Depends.begin();
  54. i != m_Depends.end(); ++i)
  55. {
  56. mf.ExpandVariablesInString(*i);
  57. }
  58. }
  59. bool cmCustomCommand::IsEquivalent(const char* command,
  60. const char* args)
  61. {
  62. if(m_Command != command)
  63. {
  64. return false;
  65. }
  66. if(m_Arguments != args)
  67. {
  68. return false;
  69. }
  70. return true;
  71. }