File: cmCommand.cxx

package info (click to toggle)
cmake 3.18.4-2%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 95,096 kB
  • sloc: ansic: 326,336; cpp: 218,301; yacc: 3,207; sh: 3,067; python: 2,637; lex: 1,324; asm: 371; lisp: 273; f90: 240; objc: 205; perl: 198; java: 197; xml: 178; cs: 140; fortran: 126; makefile: 84; javascript: 83; pascal: 63; tcl: 55; php: 25; ruby: 22
file content (59 lines) | stat: -rw-r--r-- 1,595 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
   file Copyright.txt or https://cmake.org/licensing for details.  */
#include "cmCommand.h"

#include <utility>

#include "cmExecutionStatus.h"
#include "cmMakefile.h"

struct cmListFileArgument;

void cmCommand::SetExecutionStatus(cmExecutionStatus* status)
{
  this->Status = status;
  this->Makefile = &status->GetMakefile();
}

bool cmCommand::InvokeInitialPass(const std::vector<cmListFileArgument>& args,
                                  cmExecutionStatus& status)
{
  std::vector<std::string> expandedArguments;
  if (!this->Makefile->ExpandArguments(args, expandedArguments)) {
    // There was an error expanding arguments.  It was already
    // reported, so we can skip this command without error.
    return true;
  }
  return this->InitialPass(expandedArguments, status);
}

void cmCommand::SetError(const std::string& e)
{
  this->Status->SetError(e);
}

cmLegacyCommandWrapper::cmLegacyCommandWrapper(std::unique_ptr<cmCommand> cmd)
  : Command(std::move(cmd))
{
}

cmLegacyCommandWrapper::cmLegacyCommandWrapper(
  cmLegacyCommandWrapper const& other)
  : Command(other.Command->Clone())
{
}

cmLegacyCommandWrapper& cmLegacyCommandWrapper::operator=(
  cmLegacyCommandWrapper const& other)
{
  this->Command = other.Command->Clone();
  return *this;
}

bool cmLegacyCommandWrapper::operator()(
  std::vector<cmListFileArgument> const& args, cmExecutionStatus& status) const
{
  auto cmd = this->Command->Clone();
  cmd->SetExecutionStatus(&status);
  return cmd->InvokeInitialPass(args, status);
}