cmCustomCommand.cxx 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #include "cmCustomCommand.h"
  11. #include "cmMakefile.h"
  12. #include <cmsys/auto_ptr.hxx>
  13. cmCustomCommand::cmCustomCommand()
  14. : Backtrace()
  15. {
  16. this->HaveComment = false;
  17. this->EscapeOldStyle = true;
  18. this->EscapeAllowMakeVars = false;
  19. this->UsesTerminal = false;
  20. }
  21. cmCustomCommand::cmCustomCommand(cmMakefile const* mf,
  22. const std::vector<std::string>& outputs,
  23. const std::vector<std::string>& byproducts,
  24. const std::vector<std::string>& depends,
  25. const cmCustomCommandLines& commandLines,
  26. const char* comment,
  27. const char* workingDirectory)
  28. : Outputs(outputs)
  29. , Byproducts(byproducts)
  30. , Depends(depends)
  31. , CommandLines(commandLines)
  32. , Backtrace()
  33. , Comment(comment ? comment : "")
  34. , WorkingDirectory(workingDirectory ? workingDirectory : "")
  35. , HaveComment(comment != CM_NULLPTR)
  36. , EscapeAllowMakeVars(false)
  37. , EscapeOldStyle(true)
  38. {
  39. if (mf) {
  40. this->Backtrace = mf->GetBacktrace();
  41. }
  42. }
  43. const std::vector<std::string>& cmCustomCommand::GetOutputs() const
  44. {
  45. return this->Outputs;
  46. }
  47. const std::vector<std::string>& cmCustomCommand::GetByproducts() const
  48. {
  49. return this->Byproducts;
  50. }
  51. const std::vector<std::string>& cmCustomCommand::GetDepends() const
  52. {
  53. return this->Depends;
  54. }
  55. const cmCustomCommandLines& cmCustomCommand::GetCommandLines() const
  56. {
  57. return this->CommandLines;
  58. }
  59. const char* cmCustomCommand::GetComment() const
  60. {
  61. const char* no_comment = CM_NULLPTR;
  62. return this->HaveComment ? this->Comment.c_str() : no_comment;
  63. }
  64. void cmCustomCommand::AppendCommands(const cmCustomCommandLines& commandLines)
  65. {
  66. this->CommandLines.insert(this->CommandLines.end(), commandLines.begin(),
  67. commandLines.end());
  68. }
  69. void cmCustomCommand::AppendDepends(const std::vector<std::string>& depends)
  70. {
  71. this->Depends.insert(this->Depends.end(), depends.begin(), depends.end());
  72. }
  73. bool cmCustomCommand::GetEscapeOldStyle() const
  74. {
  75. return this->EscapeOldStyle;
  76. }
  77. void cmCustomCommand::SetEscapeOldStyle(bool b)
  78. {
  79. this->EscapeOldStyle = b;
  80. }
  81. bool cmCustomCommand::GetEscapeAllowMakeVars() const
  82. {
  83. return this->EscapeAllowMakeVars;
  84. }
  85. void cmCustomCommand::SetEscapeAllowMakeVars(bool b)
  86. {
  87. this->EscapeAllowMakeVars = b;
  88. }
  89. cmListFileBacktrace const& cmCustomCommand::GetBacktrace() const
  90. {
  91. return this->Backtrace;
  92. }
  93. cmCustomCommand::ImplicitDependsList const&
  94. cmCustomCommand::GetImplicitDepends() const
  95. {
  96. return this->ImplicitDepends;
  97. }
  98. void cmCustomCommand::SetImplicitDepends(ImplicitDependsList const& l)
  99. {
  100. this->ImplicitDepends = l;
  101. }
  102. void cmCustomCommand::AppendImplicitDepends(ImplicitDependsList const& l)
  103. {
  104. this->ImplicitDepends.insert(this->ImplicitDepends.end(), l.begin(),
  105. l.end());
  106. }
  107. bool cmCustomCommand::GetUsesTerminal() const
  108. {
  109. return this->UsesTerminal;
  110. }
  111. void cmCustomCommand::SetUsesTerminal(bool b)
  112. {
  113. this->UsesTerminal = b;
  114. }