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