cmEnableTestingCommand.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #ifndef cmEnableTestingCommand_h
  14. #define cmEnableTestingCommand_h
  15. #include "cmCommand.h"
  16. /** \class cmEnableTestingCommand
  17. * \brief Enable testing for this directory and below.
  18. *
  19. * Produce the output testfile. This produces a file in the build directory
  20. * called CMakeTestfile with a syntax similar to CMakeLists.txt. It contains
  21. * the SUBDIRS() and ADD_TEST() commands from the source CMakeLists.txt
  22. * file with CMake variables expanded. Only the subdirs and tests
  23. * within the valid control structures are replicated in Testfile
  24. * (i.e. SUBDIRS() and ADD_TEST() commands within IF() commands that are
  25. * not entered by CMake are not replicated in Testfile).
  26. * Note that Dart expects to find this file in the build directory root;
  27. * therefore, this command should be in the source directory root too.
  28. */
  29. class cmEnableTestingCommand : public cmCommand
  30. {
  31. public:
  32. /**
  33. * This is a virtual constructor for the command.
  34. */
  35. virtual cmCommand* Clone()
  36. {
  37. return new cmEnableTestingCommand;
  38. }
  39. /**
  40. * This determines if the command gets propagated down
  41. * to makefiles located in subdirectories.
  42. */
  43. virtual bool IsInherited() {return true;}
  44. /**
  45. * This is called when the command is first encountered in
  46. * the CMakeLists.txt file.
  47. */
  48. virtual bool InitialPass(std::vector<std::string> const&) {return true;}
  49. /**
  50. * This is called at the end after all the information
  51. * specified by the command is accumulated. Most commands do
  52. * not implement this method. At this point, reading and
  53. * writing to the cache can be done.
  54. */
  55. virtual void FinalPass();
  56. /**
  57. * The name of the command as specified in CMakeList.txt.
  58. */
  59. virtual const char* GetName() { return "ENABLE_TESTING";}
  60. /**
  61. * Succinct documentation.
  62. */
  63. virtual const char* GetTerseDocumentation()
  64. {
  65. return "Enable testing for current directory and below.";
  66. }
  67. /**
  68. * More documentation.
  69. */
  70. virtual const char* GetFullDocumentation()
  71. {
  72. return
  73. " ENABLE_TESTING()\n"
  74. "Enables testing for this directory and below. "
  75. "See also the ADD_TEST command. Note that Dart expects to find "
  76. "a test file in the build directory root. Therefore, this command "
  77. "should be in the source directory root too.";
  78. }
  79. cmTypeMacro(cmEnableTestingCommand, cmCommand);
  80. };
  81. #endif