You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

156 lines
4.9 KiB

  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. //----------------------------------------------------------------------------
  15. cmCustomCommand::cmCustomCommand()
  16. {
  17. this->HaveComment = false;
  18. this->EscapeOldStyle = true;
  19. this->EscapeAllowMakeVars = false;
  20. }
  21. //----------------------------------------------------------------------------
  22. cmCustomCommand::cmCustomCommand(const cmCustomCommand& r):
  23. Outputs(r.Outputs),
  24. Depends(r.Depends),
  25. CommandLines(r.CommandLines),
  26. HaveComment(r.HaveComment),
  27. Comment(r.Comment),
  28. WorkingDirectory(r.WorkingDirectory),
  29. EscapeAllowMakeVars(r.EscapeAllowMakeVars),
  30. EscapeOldStyle(r.EscapeOldStyle)
  31. {
  32. }
  33. //----------------------------------------------------------------------------
  34. cmCustomCommand::cmCustomCommand(const std::vector<std::string>& outputs,
  35. const std::vector<std::string>& depends,
  36. const cmCustomCommandLines& commandLines,
  37. const char* comment,
  38. const char* workingDirectory):
  39. Outputs(outputs),
  40. Depends(depends),
  41. CommandLines(commandLines),
  42. HaveComment(comment?true:false),
  43. Comment(comment?comment:""),
  44. WorkingDirectory(workingDirectory?workingDirectory:""),
  45. EscapeAllowMakeVars(false),
  46. EscapeOldStyle(true)
  47. {
  48. this->EscapeOldStyle = true;
  49. this->EscapeAllowMakeVars = false;
  50. }
  51. //----------------------------------------------------------------------------
  52. const std::vector<std::string>& cmCustomCommand::GetOutputs() const
  53. {
  54. return this->Outputs;
  55. }
  56. //----------------------------------------------------------------------------
  57. const char* cmCustomCommand::GetWorkingDirectory() const
  58. {
  59. if(this->WorkingDirectory.size() == 0)
  60. {
  61. return 0;
  62. }
  63. return this->WorkingDirectory.c_str();
  64. }
  65. //----------------------------------------------------------------------------
  66. const std::vector<std::string>& cmCustomCommand::GetDepends() const
  67. {
  68. return this->Depends;
  69. }
  70. //----------------------------------------------------------------------------
  71. const cmCustomCommandLines& cmCustomCommand::GetCommandLines() const
  72. {
  73. return this->CommandLines;
  74. }
  75. //----------------------------------------------------------------------------
  76. const char* cmCustomCommand::GetComment() const
  77. {
  78. const char* no_comment = 0;
  79. return this->HaveComment? this->Comment.c_str() : no_comment;
  80. }
  81. //----------------------------------------------------------------------------
  82. void cmCustomCommand::AppendCommands(const cmCustomCommandLines& commandLines)
  83. {
  84. for(cmCustomCommandLines::const_iterator i=commandLines.begin();
  85. i != commandLines.end(); ++i)
  86. {
  87. this->CommandLines.push_back(*i);
  88. }
  89. }
  90. //----------------------------------------------------------------------------
  91. void cmCustomCommand::AppendDepends(const std::vector<std::string>& depends)
  92. {
  93. for(std::vector<std::string>::const_iterator i=depends.begin();
  94. i != depends.end(); ++i)
  95. {
  96. this->Depends.push_back(*i);
  97. }
  98. }
  99. //----------------------------------------------------------------------------
  100. bool cmCustomCommand::GetEscapeOldStyle() const
  101. {
  102. return this->EscapeOldStyle;
  103. }
  104. //----------------------------------------------------------------------------
  105. void cmCustomCommand::SetEscapeOldStyle(bool b)
  106. {
  107. this->EscapeOldStyle = b;
  108. }
  109. //----------------------------------------------------------------------------
  110. bool cmCustomCommand::GetEscapeAllowMakeVars() const
  111. {
  112. return this->EscapeAllowMakeVars;
  113. }
  114. //----------------------------------------------------------------------------
  115. void cmCustomCommand::SetEscapeAllowMakeVars(bool b)
  116. {
  117. this->EscapeAllowMakeVars = b;
  118. }
  119. //----------------------------------------------------------------------------
  120. cmCustomCommand::ImplicitDependsList const&
  121. cmCustomCommand::GetImplicitDepends() const
  122. {
  123. return this->ImplicitDepends;
  124. }
  125. //----------------------------------------------------------------------------
  126. void cmCustomCommand::SetImplicitDepends(ImplicitDependsList const& l)
  127. {
  128. this->ImplicitDepends = l;
  129. }
  130. //----------------------------------------------------------------------------
  131. void cmCustomCommand::AppendImplicitDepends(ImplicitDependsList const& l)
  132. {
  133. this->ImplicitDepends.insert(this->ImplicitDepends.end(),
  134. l.begin(), l.end());
  135. }