cmTest.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 char *prop, const char *value);
  42. void AppendProperty(const char* prop, const char* value,bool asString=false);
  43. const char *GetProperty(const char *prop) const;
  44. bool GetPropertyAsBool(const char *prop) const;
  45. cmPropertyMap &GetProperties() { return this->Properties; };
  46. // Define the properties
  47. static void DefineProperties(cmake *cm);
  48. /** Get the cmMakefile instance that owns this test. */
  49. cmMakefile *GetMakefile() { return this->Makefile;};
  50. /** Get the backtrace of the command that created this test. */
  51. cmListFileBacktrace const& GetBacktrace() const;
  52. /** Get/Set whether this is an old-style test. */
  53. bool GetOldStyle() const { return this->OldStyle; }
  54. void SetOldStyle(bool b) { this->OldStyle = b; }
  55. private:
  56. cmPropertyMap Properties;
  57. cmStdString Name;
  58. std::vector<std::string> Command;
  59. bool OldStyle;
  60. cmMakefile* Makefile;
  61. cmListFileBacktrace* Backtrace;
  62. };
  63. #endif