cmCustomCommand.cxx 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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 <cassert>
  5. #include <utility>
  6. #include <cmext/algorithm>
  7. const std::vector<std::string>& cmCustomCommand::GetOutputs() const
  8. {
  9. return this->Outputs;
  10. }
  11. void cmCustomCommand::SetOutputs(std::vector<std::string> outputs)
  12. {
  13. this->Outputs = std::move(outputs);
  14. }
  15. void cmCustomCommand::SetOutputs(std::string output)
  16. {
  17. this->Outputs = { std::move(output) };
  18. }
  19. const std::vector<std::string>& cmCustomCommand::GetByproducts() const
  20. {
  21. return this->Byproducts;
  22. }
  23. void cmCustomCommand::SetByproducts(std::vector<std::string> byproducts)
  24. {
  25. this->Byproducts = std::move(byproducts);
  26. }
  27. const std::vector<std::string>& cmCustomCommand::GetDepends() const
  28. {
  29. return this->Depends;
  30. }
  31. void cmCustomCommand::SetDepends(std::vector<std::string> depends)
  32. {
  33. if (this->HasMainDependency_) {
  34. depends.insert(depends.begin(), std::move(this->Depends[0]));
  35. }
  36. Depends = std::move(depends);
  37. }
  38. const std::string& cmCustomCommand::GetMainDependency() const
  39. {
  40. assert(this->HasMainDependency_);
  41. return this->Depends[0];
  42. }
  43. void cmCustomCommand::SetMainDependency(std::string main_dependency)
  44. {
  45. if (this->HasMainDependency_) {
  46. assert(!main_dependency.empty());
  47. this->Depends[0] = std::move(main_dependency);
  48. } else if (main_dependency.empty()) {
  49. // Do nothing.
  50. } else {
  51. this->Depends.insert(this->Depends.begin(), std::move(main_dependency));
  52. this->HasMainDependency_ = true;
  53. }
  54. }
  55. const cmCustomCommandLines& cmCustomCommand::GetCommandLines() const
  56. {
  57. return this->CommandLines;
  58. }
  59. void cmCustomCommand::SetCommandLines(cmCustomCommandLines commandLines)
  60. {
  61. this->CommandLines = std::move(commandLines);
  62. }
  63. const char* cmCustomCommand::GetComment() const
  64. {
  65. const char* no_comment = nullptr;
  66. return this->HaveComment ? this->Comment.c_str() : no_comment;
  67. }
  68. void cmCustomCommand::SetComment(const char* comment)
  69. {
  70. this->Comment = comment ? comment : "";
  71. this->HaveComment = (comment != nullptr);
  72. }
  73. void cmCustomCommand::AppendCommands(const cmCustomCommandLines& commandLines)
  74. {
  75. cm::append(this->CommandLines, commandLines);
  76. }
  77. void cmCustomCommand::AppendDepends(const std::vector<std::string>& depends)
  78. {
  79. cm::append(this->Depends, depends);
  80. }
  81. bool cmCustomCommand::GetEscapeOldStyle() const
  82. {
  83. return this->EscapeOldStyle;
  84. }
  85. void cmCustomCommand::SetEscapeOldStyle(bool b)
  86. {
  87. this->EscapeOldStyle = b;
  88. }
  89. bool cmCustomCommand::GetEscapeAllowMakeVars() const
  90. {
  91. return this->EscapeAllowMakeVars;
  92. }
  93. void cmCustomCommand::SetEscapeAllowMakeVars(bool b)
  94. {
  95. this->EscapeAllowMakeVars = b;
  96. }
  97. cmListFileBacktrace const& cmCustomCommand::GetBacktrace() const
  98. {
  99. return this->Backtrace;
  100. }
  101. void cmCustomCommand::SetBacktrace(cmListFileBacktrace lfbt)
  102. {
  103. this->Backtrace = std::move(lfbt);
  104. }
  105. cmImplicitDependsList const& cmCustomCommand::GetImplicitDepends() const
  106. {
  107. return this->ImplicitDepends;
  108. }
  109. void cmCustomCommand::SetImplicitDepends(cmImplicitDependsList const& l)
  110. {
  111. this->ImplicitDepends = l;
  112. }
  113. void cmCustomCommand::AppendImplicitDepends(cmImplicitDependsList const& l)
  114. {
  115. cm::append(this->ImplicitDepends, l);
  116. }
  117. bool cmCustomCommand::GetUsesTerminal() const
  118. {
  119. return this->UsesTerminal;
  120. }
  121. void cmCustomCommand::SetUsesTerminal(bool b)
  122. {
  123. this->UsesTerminal = b;
  124. }
  125. bool cmCustomCommand::GetCommandExpandLists() const
  126. {
  127. return this->CommandExpandLists;
  128. }
  129. void cmCustomCommand::SetCommandExpandLists(bool b)
  130. {
  131. this->CommandExpandLists = b;
  132. }
  133. const std::string& cmCustomCommand::GetDepfile() const
  134. {
  135. return this->Depfile;
  136. }
  137. void cmCustomCommand::SetDepfile(const std::string& depfile)
  138. {
  139. this->Depfile = depfile;
  140. }
  141. const std::string& cmCustomCommand::GetJobPool() const
  142. {
  143. return this->JobPool;
  144. }
  145. void cmCustomCommand::SetJobPool(const std::string& job_pool)
  146. {
  147. this->JobPool = job_pool;
  148. }
  149. cmPolicies::PolicyStatus cmCustomCommand::GetCMP0116Status() const
  150. {
  151. return this->CMP0116Status;
  152. }
  153. void cmCustomCommand::SetCMP0116Status(cmPolicies::PolicyStatus cmp0116)
  154. {
  155. this->CMP0116Status = cmp0116;
  156. }
  157. const std::string& cmCustomCommand::GetTarget() const
  158. {
  159. return this->Target;
  160. }
  161. void cmCustomCommand::SetTarget(const std::string& target)
  162. {
  163. this->Target = target;
  164. }