cmTest.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #ifndef cmTest_h
  11. #define cmTest_h
  12. #include "cmCustomCommand.h"
  13. #include "cmPropertyMap.h"
  14. #include "cmListFileCache.h"
  15. class cmMakefile;
  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. ///! Set the test name
  29. void SetName(const std::string& name);
  30. std::string GetName() const { return this->Name; }
  31. void SetCommand(std::vector<std::string> const& command);
  32. std::vector<std::string> const& GetCommand() const
  33. {
  34. 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 AppendProperty(const std::string& prop,
  39. const char* value,bool asString=false);
  40. const char *GetProperty(const std::string& prop) const;
  41. bool GetPropertyAsBool(const std::string& prop) const;
  42. cmPropertyMap &GetProperties() { return this->Properties; }
  43. /** Get the cmMakefile instance that owns this test. */
  44. cmMakefile *GetMakefile() { return this->Makefile;}
  45. /** Get the backtrace of the command that created this test. */
  46. cmListFileBacktrace const& GetBacktrace() const;
  47. /** Get/Set whether this is an old-style test. */
  48. bool GetOldStyle() const { return this->OldStyle; }
  49. void SetOldStyle(bool b) { this->OldStyle = b; }
  50. private:
  51. cmPropertyMap Properties;
  52. std::string Name;
  53. std::vector<std::string> Command;
  54. bool OldStyle;
  55. cmMakefile* Makefile;
  56. cmListFileBacktrace Backtrace;
  57. };
  58. #endif