1 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 file Copyright.txt or https://cmake.org/licensing for details. */
5 #include "cmConfigure.h" // IWYU pragma: keep
11 #include "cmListFileCache.h"
12 #include "cmPolicies.h"
13 #include "cmPropertyMap.h"
19 * \brief Represent a test
21 * cmTest is representation of a test.
28 cmTest(cmMakefile
* mf
);
32 void SetName(const std::string
& name
);
33 std::string
GetName() const { return this->Name
; }
35 void SetCommand(std::vector
<std::string
> const& command
);
36 std::vector
<std::string
> const& GetCommand() const { return this->Command
; }
38 //! Set/Get a property of this source file
39 void SetProperty(const std::string
& prop
, cmValue value
);
40 void SetProperty(const std::string
& prop
, std::nullptr_t
)
42 this->SetProperty(prop
, cmValue
{ nullptr });
44 void SetProperty(const std::string
& prop
, const std::string
& value
)
46 this->SetProperty(prop
, cmValue(value
));
48 void AppendProperty(const std::string
& prop
, const std::string
& value
,
49 bool asString
= false);
50 cmValue
GetProperty(const std::string
& prop
) const;
51 bool GetPropertyAsBool(const std::string
& prop
) const;
52 cmPropertyMap
& GetProperties() { return this->Properties
; }
54 /** Get the cmMakefile instance that owns this test. */
55 cmMakefile
* GetMakefile() { return this->Makefile
; }
57 /** Get the backtrace of the command that created this test. */
58 cmListFileBacktrace
const& GetBacktrace() const;
60 /** Get/Set whether this is an old-style test. */
61 bool GetOldStyle() const { return this->OldStyle
; }
62 void SetOldStyle(bool b
) { this->OldStyle
= b
; }
64 /** Get/Set if CMP0158 policy is NEW */
65 bool GetCMP0158IsNew() const
67 return this->PolicyStatusCMP0158
== cmPolicies::NEW
;
70 /** Set/Get whether lists in command lines should be expanded. */
71 bool GetCommandExpandLists() const;
72 void SetCommandExpandLists(bool b
);
75 cmPropertyMap Properties
;
77 std::vector
<std::string
> Command
;
78 bool CommandExpandLists
= false;
83 cmListFileBacktrace Backtrace
;
84 cmPolicies::PolicyStatus PolicyStatusCMP0158
;