cmCustomCommand.cxx 3.25 KB
Newer Older
1 2
/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
   file Copyright.txt or https://cmake.org/licensing for details.  */
3 4
#include "cmCustomCommand.h"

5
#include "cmAlgorithms.h"
6 7
#include "cmMakefile.h"

wahikihiki's avatar
wahikihiki committed
8 9
#include <utility>

10
cmCustomCommand::cmCustomCommand(cmMakefile const* mf,
wahikihiki's avatar
wahikihiki committed
11 12 13 14
                                 std::vector<std::string> outputs,
                                 std::vector<std::string> byproducts,
                                 std::vector<std::string> depends,
                                 cmCustomCommandLines commandLines,
15
                                 const char* comment,
16
                                 const char* workingDirectory)
wahikihiki's avatar
wahikihiki committed
17 18 19 20
  : Outputs(std::move(outputs))
  , Byproducts(std::move(byproducts))
  , Depends(std::move(depends))
  , CommandLines(std::move(commandLines))
21 22
  , Comment(comment ? comment : "")
  , WorkingDirectory(workingDirectory ? workingDirectory : "")
Daniel Pfeifer's avatar
Daniel Pfeifer committed
23
  , HaveComment(comment != nullptr)
24 25
{
  if (mf) {
26
    this->Backtrace = mf->GetBacktrace();
27
  }
28 29
}

30
const std::vector<std::string>& cmCustomCommand::GetOutputs() const
31
{
32
  return this->Outputs;
33
}
34

35 36 37 38 39
const std::vector<std::string>& cmCustomCommand::GetByproducts() const
{
  return this->Byproducts;
}

40 41
const std::vector<std::string>& cmCustomCommand::GetDepends() const
{
42
  return this->Depends;
43
}
44

45 46
const cmCustomCommandLines& cmCustomCommand::GetCommandLines() const
{
47
  return this->CommandLines;
48
}
49

50
const char* cmCustomCommand::GetComment() const
51
{
Daniel Pfeifer's avatar
Daniel Pfeifer committed
52
  const char* no_comment = nullptr;
53
  return this->HaveComment ? this->Comment.c_str() : no_comment;
54
}
55

56 57
void cmCustomCommand::AppendCommands(const cmCustomCommandLines& commandLines)
{
58
  cmAppend(this->CommandLines, commandLines);
59 60 61 62
}

void cmCustomCommand::AppendDepends(const std::vector<std::string>& depends)
{
63
  cmAppend(this->Depends, depends);
64 65
}

66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
bool cmCustomCommand::GetEscapeOldStyle() const
{
  return this->EscapeOldStyle;
}

void cmCustomCommand::SetEscapeOldStyle(bool b)
{
  this->EscapeOldStyle = b;
}

bool cmCustomCommand::GetEscapeAllowMakeVars() const
{
  return this->EscapeAllowMakeVars;
}

void cmCustomCommand::SetEscapeAllowMakeVars(bool b)
{
  this->EscapeAllowMakeVars = b;
}
85

86 87
cmListFileBacktrace const& cmCustomCommand::GetBacktrace() const
{
88
  return this->Backtrace;
89 90
}

91 92 93 94 95 96 97 98 99 100 101 102 103
cmCustomCommand::ImplicitDependsList const&
cmCustomCommand::GetImplicitDepends() const
{
  return this->ImplicitDepends;
}

void cmCustomCommand::SetImplicitDepends(ImplicitDependsList const& l)
{
  this->ImplicitDepends = l;
}

void cmCustomCommand::AppendImplicitDepends(ImplicitDependsList const& l)
{
104
  cmAppend(this->ImplicitDepends, l);
105
}
106 107 108 109 110 111 112 113 114 115

bool cmCustomCommand::GetUsesTerminal() const
{
  return this->UsesTerminal;
}

void cmCustomCommand::SetUsesTerminal(bool b)
{
  this->UsesTerminal = b;
}
116

117 118 119 120 121 122 123 124 125 126
bool cmCustomCommand::GetCommandExpandLists() const
{
  return this->CommandExpandLists;
}

void cmCustomCommand::SetCommandExpandLists(bool b)
{
  this->CommandExpandLists = b;
}

127 128 129 130 131 132 133 134 135
const std::string& cmCustomCommand::GetDepfile() const
{
  return this->Depfile;
}

void cmCustomCommand::SetDepfile(const std::string& depfile)
{
  this->Depfile = depfile;
}
136 137 138 139 140 141 142 143 144 145

const std::string& cmCustomCommand::GetJobPool() const
{
  return this->JobPool;
}

void cmCustomCommand::SetJobPool(const std::string& job_pool)
{
  this->JobPool = job_pool;
}