/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 <utility> |
6 | | |
7 | | #include "cmMakefile.h" |
8 | | #include "cmProperty.h" |
9 | | #include "cmState.h" |
10 | | #include "cmValue.h" |
11 | | |
12 | | cmTest::cmTest(cmMakefile* mf) |
13 | 0 | : Backtrace(mf->GetBacktrace()) |
14 | 0 | , PolicyStatusCMP0158(mf->GetPolicyStatus(cmPolicies::CMP0158)) |
15 | 0 | , PolicyStatusCMP0178(mf->GetPolicyStatus(cmPolicies::CMP0178)) |
16 | 0 | , PolicyStatusCMP0224(mf->GetPolicyStatus(cmPolicies::CMP0224)) |
17 | 0 | { |
18 | 0 | this->Makefile = mf; |
19 | 0 | this->OldStyle = true; |
20 | 0 | } |
21 | | |
22 | 0 | cmTest::~cmTest() = default; |
23 | | |
24 | | cmListFileBacktrace const& cmTest::GetBacktrace() const |
25 | 0 | { |
26 | 0 | return this->Backtrace; |
27 | 0 | } |
28 | | |
29 | | void cmTest::SetName(std::string const& name) |
30 | 0 | { |
31 | 0 | this->Name = name; |
32 | 0 | } |
33 | | |
34 | | void cmTest::SetCommand(std::vector<std::string> const& command) |
35 | 0 | { |
36 | 0 | this->Command = command; |
37 | 0 | } |
38 | | |
39 | | void cmTest::SetBuildDependencies(std::vector<std::string> deps) |
40 | 0 | { |
41 | 0 | this->BuildDependencies = std::move(deps); |
42 | 0 | } |
43 | | |
44 | | cmValue cmTest::GetProperty(std::string const& prop) const |
45 | 0 | { |
46 | 0 | cmValue retVal = this->Properties.GetPropertyValue(prop); |
47 | 0 | if (!retVal) { |
48 | 0 | bool const chain = |
49 | 0 | this->Makefile->GetState()->IsPropertyChained(prop, cmProperty::TEST); |
50 | 0 | if (chain) { |
51 | 0 | if (cmValue p = this->Makefile->GetProperty(prop, chain)) { |
52 | 0 | return p; |
53 | 0 | } |
54 | 0 | } |
55 | 0 | return nullptr; |
56 | 0 | } |
57 | 0 | return retVal; |
58 | 0 | } |
59 | | |
60 | | bool cmTest::GetPropertyAsBool(std::string const& prop) const |
61 | 0 | { |
62 | 0 | return this->GetProperty(prop).IsOn(); |
63 | 0 | } |
64 | | |
65 | | void cmTest::SetProperty(std::string const& prop, cmValue value) |
66 | 0 | { |
67 | 0 | this->Properties.SetProperty(prop, value); |
68 | 0 | } |
69 | | |
70 | | void cmTest::AppendProperty(std::string const& prop, std::string const& value, |
71 | | bool asString) |
72 | 0 | { |
73 | 0 | this->Properties.AppendProperty(prop, value, asString); |
74 | 0 | } |
75 | | |
76 | | bool cmTest::GetCommandExpandLists() const |
77 | 0 | { |
78 | 0 | return this->CommandExpandLists; |
79 | 0 | } |
80 | | |
81 | | void cmTest::SetCommandExpandLists(bool b) |
82 | 0 | { |
83 | 0 | this->CommandExpandLists = b; |
84 | 0 | } |