cmCustomCommand.cxx 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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 "cmAlgorithms.h"
  5. #include "cmMakefile.h"
  6. #include <utility>
  7. cmCustomCommand::cmCustomCommand(cmMakefile const* mf,
  8. std::vector<std::string> outputs,
  9. std::vector<std::string> byproducts,
  10. std::vector<std::string> depends,
  11. cmCustomCommandLines commandLines,
  12. const char* comment,
  13. const char* workingDirectory)
  14. : Outputs(std::move(outputs))
  15. , Byproducts(std::move(byproducts))
  16. , Depends(std::move(depends))
  17. , CommandLines(std::move(commandLines))
  18. , Comment(comment ? comment : "")
  19. , WorkingDirectory(workingDirectory ? workingDirectory : "")
  20. , HaveComment(comment != nullptr)
  21. {
  22. if (mf) {
  23. this->Backtrace = mf->GetBacktrace();
  24. }
  25. }
  26. const std::vector<std::string>& cmCustomCommand::GetOutputs() const
  27. {
  28. return this->Outputs;
  29. }
  30. const std::vector<std::string>& cmCustomCommand::GetByproducts() const
  31. {
  32. return this->Byproducts;
  33. }
  34. const std::vector<std::string>& cmCustomCommand::GetDepends() const
  35. {
  36. return this->Depends;
  37. }
  38. const cmCustomCommandLines& cmCustomCommand::GetCommandLines() const
  39. {
  40. return this->CommandLines;
  41. }
  42. const char* cmCustomCommand::GetComment() const
  43. {
  44. const char* no_comment = nullptr;
  45. return this->HaveComment ? this->Comment.c_str() : no_comment;
  46. }
  47. void cmCustomCommand::AppendCommands(const cmCustomCommandLines& commandLines)
  48. {
  49. cmAppend(this->CommandLines, commandLines);
  50. }
  51. void cmCustomCommand::AppendDepends(const std::vector<std::string>& depends)
  52. {
  53. cmAppend(this->Depends, depends);
  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. cmImplicitDependsList const& cmCustomCommand::GetImplicitDepends() const
  76. {
  77. return this->ImplicitDepends;
  78. }
  79. void cmCustomCommand::SetImplicitDepends(cmImplicitDependsList const& l)
  80. {
  81. this->ImplicitDepends = l;
  82. }
  83. void cmCustomCommand::AppendImplicitDepends(cmImplicitDependsList const& l)
  84. {
  85. cmAppend(this->ImplicitDepends, l);
  86. }
  87. bool cmCustomCommand::GetUsesTerminal() const
  88. {
  89. return this->UsesTerminal;
  90. }
  91. void cmCustomCommand::SetUsesTerminal(bool b)
  92. {
  93. this->UsesTerminal = b;
  94. }
  95. bool cmCustomCommand::GetCommandExpandLists() const
  96. {
  97. return this->CommandExpandLists;
  98. }
  99. void cmCustomCommand::SetCommandExpandLists(bool b)
  100. {
  101. this->CommandExpandLists = b;
  102. }
  103. const std::string& cmCustomCommand::GetDepfile() const
  104. {
  105. return this->Depfile;
  106. }
  107. void cmCustomCommand::SetDepfile(const std::string& depfile)
  108. {
  109. this->Depfile = depfile;
  110. }
  111. const std::string& cmCustomCommand::GetJobPool() const
  112. {
  113. return this->JobPool;
  114. }
  115. void cmCustomCommand::SetJobPool(const std::string& job_pool)
  116. {
  117. this->JobPool = job_pool;
  118. }