cmCustomCommand.cxx 3.2 KB

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