resolve cyclic dependency with zstd
[platform/upstream/cmake.git] / Source / cmTest.cxx
1 /* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
2    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 "cmValue.h"
9
10 cmTest::cmTest(cmMakefile* mf)
11   : Backtrace(mf->GetBacktrace())
12 {
13   this->Makefile = mf;
14   this->OldStyle = true;
15 }
16
17 cmTest::~cmTest() = default;
18
19 cmListFileBacktrace const& cmTest::GetBacktrace() const
20 {
21   return this->Backtrace;
22 }
23
24 void cmTest::SetName(const std::string& name)
25 {
26   this->Name = name;
27 }
28
29 void cmTest::SetCommand(std::vector<std::string> const& command)
30 {
31   this->Command = command;
32 }
33
34 cmValue cmTest::GetProperty(const std::string& prop) const
35 {
36   cmValue retVal = this->Properties.GetPropertyValue(prop);
37   if (!retVal) {
38     const bool chain =
39       this->Makefile->GetState()->IsPropertyChained(prop, cmProperty::TEST);
40     if (chain) {
41       if (cmValue p = this->Makefile->GetProperty(prop, chain)) {
42         return p;
43       }
44     }
45     return nullptr;
46   }
47   return retVal;
48 }
49
50 bool cmTest::GetPropertyAsBool(const std::string& prop) const
51 {
52   return cmIsOn(this->GetProperty(prop));
53 }
54
55 void cmTest::SetProperty(const std::string& prop, const char* value)
56 {
57   this->Properties.SetProperty(prop, value);
58 }
59 void cmTest::SetProperty(const std::string& prop, cmValue value)
60 {
61   this->Properties.SetProperty(prop, value);
62 }
63
64 void cmTest::AppendProperty(const std::string& prop, const std::string& value,
65                             bool asString)
66 {
67   this->Properties.AppendProperty(prop, value, asString);
68 }
69
70 bool cmTest::GetCommandExpandLists() const
71 {
72   return this->CommandExpandLists;
73 }
74
75 void cmTest::SetCommandExpandLists(bool b)
76 {
77   this->CommandExpandLists = b;
78 }