cmTest.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. class cmMakefile;
  15. class cmListFileBacktrace;
  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 char* name);
  30. const char* GetName() const { return this->Name.c_str(); }
  31. void SetCommand(std::vector<std::string> const& command);
  32. std::vector<std::string> const& GetCommand() const
  33. {
  34. return this->Command;
  35. }
  36. /**
  37. * Print the structure to std::cout.
  38. */
  39. void Print() const;
  40. ///! Set/Get a property of this source file
  41. void SetProperty(const std::string& prop, const char *value);
  42. void AppendProperty(const std::string& prop,
  43. const char* value,bool asString=false);
  44. const char *GetProperty(const std::string& prop) const;
  45. bool GetPropertyAsBool(const std::string& prop) const;
  46. cmPropertyMap &GetProperties() { return this->Properties; };
  47. /** Get the cmMakefile instance that owns this test. */
  48. cmMakefile *GetMakefile() { return this->Makefile;};
  49. /** Get the backtrace of the command that created this test. */
  50. cmListFileBacktrace const& GetBacktrace() const;
  51. /** Get/Set whether this is an old-style test. */
  52. bool GetOldStyle() const { return this->OldStyle; }
  53. void SetOldStyle(bool b) { this->OldStyle = b; }
  54. private:
  55. cmPropertyMap Properties;
  56. cmStdString Name;
  57. std::vector<std::string> Command;
  58. bool OldStyle;
  59. cmMakefile* Makefile;
  60. cmListFileBacktrace* Backtrace;
  61. };
  62. #endif