cmCustomCommand.cxx 5.0 KB

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