resolve cyclic dependency with zstd
[platform/upstream/cmake.git] / Source / cmTest.h
1 /* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
2    file Copyright.txt or https://cmake.org/licensing for details.  */
3 #pragma once
4
5 #include "cmConfigure.h" // IWYU pragma: keep
6
7 #include <string>
8 #include <vector>
9
10 #include "cmListFileCache.h"
11 #include "cmPropertyMap.h"
12 #include "cmValue.h"
13
14 class cmMakefile;
15
16 /** \class cmTest
17  * \brief Represent a test
18  *
19  * cmTest is representation of a test.
20  */
21 class cmTest
22 {
23 public:
24   /**
25    */
26   cmTest(cmMakefile* mf);
27   ~cmTest();
28
29   //! Set the test name
30   void SetName(const std::string& name);
31   std::string GetName() const { return this->Name; }
32
33   void SetCommand(std::vector<std::string> const& command);
34   std::vector<std::string> const& GetCommand() const { return this->Command; }
35
36   //! Set/Get a property of this source file
37   void SetProperty(const std::string& prop, const char* value);
38   void SetProperty(const std::string& prop, cmValue value);
39   void SetProperty(const std::string& prop, const std::string& value)
40   {
41     this->SetProperty(prop, cmValue(value));
42   }
43   void AppendProperty(const std::string& prop, const std::string& value,
44                       bool asString = false);
45   cmValue GetProperty(const std::string& prop) const;
46   bool GetPropertyAsBool(const std::string& prop) const;
47   cmPropertyMap& GetProperties() { return this->Properties; }
48
49   /** Get the cmMakefile instance that owns this test.  */
50   cmMakefile* GetMakefile() { return this->Makefile; }
51
52   /** Get the backtrace of the command that created this test.  */
53   cmListFileBacktrace const& GetBacktrace() const;
54
55   /** Get/Set whether this is an old-style test.  */
56   bool GetOldStyle() const { return this->OldStyle; }
57   void SetOldStyle(bool b) { this->OldStyle = b; }
58
59   /** Set/Get whether lists in command lines should be expanded. */
60   bool GetCommandExpandLists() const;
61   void SetCommandExpandLists(bool b);
62
63 private:
64   cmPropertyMap Properties;
65   std::string Name;
66   std::vector<std::string> Command;
67   bool CommandExpandLists = false;
68
69   bool OldStyle;
70
71   cmMakefile* Makefile;
72   cmListFileBacktrace Backtrace;
73 };