cmCustomCommand.cxx 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #include "cmCustomCommand.h"
  4. #include "cmMakefile.h"
  5. cmCustomCommand::cmCustomCommand()
  6. : Backtrace()
  7. {
  8. this->HaveComment = false;
  9. this->EscapeOldStyle = true;
  10. this->EscapeAllowMakeVars = false;
  11. this->UsesTerminal = false;
  12. this->CommandExpandLists = false;
  13. }
  14. cmCustomCommand::cmCustomCommand(cmMakefile const* mf,
  15. const std::vector<std::string>& outputs,
  16. const std::vector<std::string>& byproducts,
  17. const std::vector<std::string>& depends,
  18. const cmCustomCommandLines& commandLines,
  19. const char* comment,
  20. const char* workingDirectory)
  21. : Outputs(outputs)
  22. , Byproducts(byproducts)
  23. , Depends(depends)
  24. , CommandLines(commandLines)
  25. , Backtrace()
  26. , Comment(comment ? comment : "")
  27. , WorkingDirectory(workingDirectory ? workingDirectory : "")
  28. , HaveComment(comment != nullptr)
  29. , EscapeAllowMakeVars(false)
  30. , EscapeOldStyle(true)
  31. , CommandExpandLists(false)
  32. {
  33. if (mf) {
  34. this->Backtrace = mf->GetBacktrace();
  35. }
  36. }
  37. const std::vector<std::string>& cmCustomCommand::GetOutputs() const
  38. {
  39. return this->Outputs;
  40. }
  41. const std::vector<std::string>& cmCustomCommand::GetByproducts() const
  42. {
  43. return this->Byproducts;
  44. }
  45. const std::vector<std::string>& cmCustomCommand::GetDepends() const
  46. {
  47. return this->Depends;
  48. }
  49. const cmCustomCommandLines& cmCustomCommand::GetCommandLines() const
  50. {
  51. return this->CommandLines;
  52. }
  53. const char* cmCustomCommand::GetComment() const
  54. {
  55. const char* no_comment = nullptr;
  56. return this->HaveComment ? this->Comment.c_str() : no_comment;
  57. }
  58. void cmCustomCommand::AppendCommands(const cmCustomCommandLines& commandLines)
  59. {
  60. this->CommandLines.insert(this->CommandLines.end(), commandLines.begin(),
  61. commandLines.end());
  62. }
  63. void cmCustomCommand::AppendDepends(const std::vector<std::string>& depends)
  64. {
  65. this->Depends.insert(this->Depends.end(), depends.begin(), depends.end());
  66. }
  67. bool cmCustomCommand::GetEscapeOldStyle() const
  68. {
  69. return this->EscapeOldStyle;
  70. }
  71. void cmCustomCommand::SetEscapeOldStyle(bool b)
  72. {
  73. this->EscapeOldStyle = b;
  74. }
  75. bool cmCustomCommand::GetEscapeAllowMakeVars() const
  76. {
  77. return this->EscapeAllowMakeVars;
  78. }
  79. void cmCustomCommand::SetEscapeAllowMakeVars(bool b)
  80. {
  81. this->EscapeAllowMakeVars = b;
  82. }
  83. cmListFileBacktrace const& cmCustomCommand::GetBacktrace() const
  84. {
  85. return this->Backtrace;
  86. }
  87. cmCustomCommand::ImplicitDependsList const&
  88. cmCustomCommand::GetImplicitDepends() const
  89. {
  90. return this->ImplicitDepends;
  91. }
  92. void cmCustomCommand::SetImplicitDepends(ImplicitDependsList const& l)
  93. {
  94. this->ImplicitDepends = l;
  95. }
  96. void cmCustomCommand::AppendImplicitDepends(ImplicitDependsList const& l)
  97. {
  98. this->ImplicitDepends.insert(this->ImplicitDepends.end(), l.begin(),
  99. l.end());
  100. }
  101. bool cmCustomCommand::GetUsesTerminal() const
  102. {
  103. return this->UsesTerminal;
  104. }
  105. void cmCustomCommand::SetUsesTerminal(bool b)
  106. {
  107. this->UsesTerminal = b;
  108. }
  109. bool cmCustomCommand::GetCommandExpandLists() const
  110. {
  111. return this->CommandExpandLists;
  112. }
  113. void cmCustomCommand::SetCommandExpandLists(bool b)
  114. {
  115. this->CommandExpandLists = b;
  116. }
  117. const std::string& cmCustomCommand::GetDepfile() const
  118. {
  119. return this->Depfile;
  120. }
  121. void cmCustomCommand::SetDepfile(const std::string& depfile)
  122. {
  123. this->Depfile = depfile;
  124. }