1
0

cmTest.h 1.9 KB

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