cmCustomCommand.cxx 3.5 KB

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