cmTest.h 1.87 KB
Newer Older
1 2
/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
   file Copyright.txt or https://cmake.org/licensing for details.  */
3 4 5
#ifndef cmTest_h
#define cmTest_h

6
#include "cmConfigure.h" // IWYU pragma: keep
7

8
#include "cmListFileCache.h"
9
#include "cmPropertyMap.h"
10 11 12 13

#include <string>
#include <vector>

14
class cmMakefile;
15 16 17 18 19 20 21 22 23 24 25

/** \class cmTest
 * \brief Represent a test
 *
 * cmTest is representation of a test.
 */
class cmTest
{
public:
  /**
   */
26
  cmTest(cmMakefile* mf);
27 28
  ~cmTest();

29
  //! Set the test name
30 31
  void SetName(const std::string& name);
  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 38 39 40
  void SetProperty(const std::string& prop, const char* value);
  void AppendProperty(const std::string& prop, const char* value,
                      bool asString = false);
  const char* GetProperty(const std::string& prop) const;
41
  bool GetPropertyAsBool(const std::string& prop) const;
42
  cmPropertyMap& GetProperties() { return this->Properties; }
43

44
  /** Get the cmMakefile instance that owns this test.  */
45
  cmMakefile* GetMakefile() { return this->Makefile; }
46

47 48 49
  /** Get the backtrace of the command that created this test.  */
  cmListFileBacktrace const& GetBacktrace() const;

50 51 52 53
  /** Get/Set whether this is an old-style test.  */
  bool GetOldStyle() const { return this->OldStyle; }
  void SetOldStyle(bool b) { this->OldStyle = b; }

54 55 56 57
  /** Set/Get whether lists in command lines should be expanded. */
  bool GetCommandExpandLists() const;
  void SetCommandExpandLists(bool b);

58
private:
59
  cmPropertyMap Properties;
60
  std::string Name;
61
  std::vector<std::string> Command;
62
  bool CommandExpandLists;
63

64 65
  bool OldStyle;

66
  cmMakefile* Makefile;
67
  cmListFileBacktrace Backtrace;
68 69 70
};

#endif