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