cmTest.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 "cmListFileCache.h"
  7. #include "cmPropertyMap.h"
  8. #include <string>
  9. #include <vector>
  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 char* 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. private:
  43. cmPropertyMap Properties;
  44. std::string Name;
  45. std::vector<std::string> Command;
  46. bool OldStyle;
  47. cmMakefile* Makefile;
  48. cmListFileBacktrace Backtrace;
  49. };
  50. #endif