cmTest.cxx 1.59 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
#include "cmTest.h"
4

5
#include "cmMakefile.h"
6
#include "cmProperty.h"
7
#include "cmState.h"
8
#include "cmSystemTools.h"
9

10
cmTest::cmTest(cmMakefile* mf)
11 12
  : CommandExpandLists(false)
  , Backtrace(mf->GetBacktrace())
13
{
14
  this->Makefile = mf;
15
  this->OldStyle = true;
16 17
}

wahikihiki's avatar
wahikihiki committed
18
cmTest::~cmTest() = default;
19 20 21

cmListFileBacktrace const& cmTest::GetBacktrace() const
{
22
  return this->Backtrace;
23 24
}

25
void cmTest::SetName(const std::string& name)
26
{
27
  this->Name = name;
28 29
}

30
void cmTest::SetCommand(std::vector<std::string> const& command)
31
{
32
  this->Command = command;
33 34
}

35
const char* cmTest::GetProperty(const std::string& prop) const
36
{
37 38 39 40 41
  const char* retVal = this->Properties.GetPropertyValue(prop);
  if (!retVal) {
    const bool chain =
      this->Makefile->GetState()->IsPropertyChained(prop, cmProperty::TEST);
    if (chain) {
42
      return this->Makefile->GetProperty(prop, chain);
43
    }
44
  }
45
  return retVal;
46 47
}

48
bool cmTest::GetPropertyAsBool(const std::string& prop) const
49
{
50
  return cmSystemTools::IsOn(this->GetProperty(prop));
51 52
}

53
void cmTest::SetProperty(const std::string& prop, const char* value)
54
{
55
  this->Properties.SetProperty(prop, value);
56 57
}

58 59
void cmTest::AppendProperty(const std::string& prop, const char* value,
                            bool asString)
60
{
61
  this->Properties.AppendProperty(prop, value, asString);
62
}
63 64 65 66 67 68 69 70 71 72

bool cmTest::GetCommandExpandLists() const
{
  return this->CommandExpandLists;
}

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