cmCustomCommand.cxx 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. #include <utility>
  6. cmCustomCommand::cmCustomCommand(cmMakefile const* mf,
  7. std::vector<std::string> outputs,
  8. std::vector<std::string> byproducts,
  9. std::vector<std::string> depends,
  10. cmCustomCommandLines commandLines,
  11. const char* comment,
  12. const char* workingDirectory)
  13. : Outputs(std::move(outputs))
  14. , Byproducts(std::move(byproducts))
  15. , Depends(std::move(depends))
  16. , CommandLines(std::move(commandLines))
  17. , Comment(comment ? comment : "")
  18. , WorkingDirectory(workingDirectory ? workingDirectory : "")
  19. , HaveComment(comment != nullptr)
  20. {
  21. if (mf) {
  22. this->Backtrace = mf->GetBacktrace();
  23. }
  24. }
  25. const std::vector<std::string>& cmCustomCommand::GetOutputs() const
  26. {
  27. return this->Outputs;
  28. }
  29. const std::vector<std::string>& cmCustomCommand::GetByproducts() const
  30. {
  31. return this->Byproducts;
  32. }
  33. const std::vector<std::string>& cmCustomCommand::GetDepends() const
  34. {
  35. return this->Depends;
  36. }
  37. const cmCustomCommandLines& cmCustomCommand::GetCommandLines() const
  38. {
  39. return this->CommandLines;
  40. }
  41. const char* cmCustomCommand::GetComment() const
  42. {
  43. const char* no_comment = nullptr;
  44. return this->HaveComment ? this->Comment.c_str() : no_comment;
  45. }
  46. void cmCustomCommand::AppendCommands(const cmCustomCommandLines& commandLines)
  47. {
  48. this->CommandLines.insert(this->CommandLines.end(), commandLines.begin(),
  49. commandLines.end());
  50. }
  51. void cmCustomCommand::AppendDepends(const std::vector<std::string>& depends)
  52. {
  53. this->Depends.insert(this->Depends.end(), depends.begin(), depends.end());
  54. }
  55. bool cmCustomCommand::GetEscapeOldStyle() const
  56. {
  57. return this->EscapeOldStyle;
  58. }
  59. void cmCustomCommand::SetEscapeOldStyle(bool b)
  60. {
  61. this->EscapeOldStyle = b;
  62. }
  63. bool cmCustomCommand::GetEscapeAllowMakeVars() const
  64. {
  65. return this->EscapeAllowMakeVars;
  66. }
  67. void cmCustomCommand::SetEscapeAllowMakeVars(bool b)
  68. {
  69. this->EscapeAllowMakeVars = b;
  70. }
  71. cmListFileBacktrace const& cmCustomCommand::GetBacktrace() const
  72. {
  73. return this->Backtrace;
  74. }
  75. cmCustomCommand::ImplicitDependsList const&
  76. cmCustomCommand::GetImplicitDepends() const
  77. {
  78. return this->ImplicitDepends;
  79. }
  80. void cmCustomCommand::SetImplicitDepends(ImplicitDependsList const& l)
  81. {
  82. this->ImplicitDepends = l;
  83. }
  84. void cmCustomCommand::AppendImplicitDepends(ImplicitDependsList const& l)
  85. {
  86. this->ImplicitDepends.insert(this->ImplicitDepends.end(), l.begin(),
  87. l.end());
  88. }
  89. bool cmCustomCommand::GetUsesTerminal() const
  90. {
  91. return this->UsesTerminal;
  92. }
  93. void cmCustomCommand::SetUsesTerminal(bool b)
  94. {
  95. this->UsesTerminal = b;
  96. }
  97. bool cmCustomCommand::GetCommandExpandLists() const
  98. {
  99. return this->CommandExpandLists;
  100. }
  101. void cmCustomCommand::SetCommandExpandLists(bool b)
  102. {
  103. this->CommandExpandLists = b;
  104. }
  105. const std::string& cmCustomCommand::GetDepfile() const
  106. {
  107. return this->Depfile;
  108. }
  109. void cmCustomCommand::SetDepfile(const std::string& depfile)
  110. {
  111. this->Depfile = depfile;
  112. }