cmCreateTestSourceList.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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 cmCreateTestSourceList_h
  14. #define cmCreateTestSourceList_h
  15. #include "cmCommand.h"
  16. /** \class cmCreateTestSourceList
  17. * \brief
  18. *
  19. */
  20. class cmCreateTestSourceList : public cmCommand
  21. {
  22. public:
  23. /**
  24. * This is a virtual constructor for the command.
  25. */
  26. virtual cmCommand* Clone()
  27. {
  28. return new cmCreateTestSourceList;
  29. }
  30. /**
  31. * This is called when the command is first encountered in
  32. * the CMakeLists.txt file.
  33. */
  34. virtual bool InitialPass(std::vector<std::string> const& args);
  35. /**
  36. * This determines if the command gets propagated down
  37. * to makefiles located in subdirectories.
  38. */
  39. virtual bool IsInherited() {return true;}
  40. /**
  41. * The name of the command as specified in CMakeList.txt.
  42. */
  43. virtual const char* GetName() {return "CREATE_TEST_SOURCELIST";}
  44. /**
  45. * Succinct documentation.
  46. */
  47. virtual const char* GetTerseDocumentation()
  48. {
  49. return "Create a test driver and source list for building test programs.";
  50. }
  51. /**
  52. * More documentation.
  53. */
  54. virtual const char* GetFullDocumentation()
  55. {
  56. return
  57. " CREATE_TEST_SOURCELIST(SourceListName DriverName\n"
  58. " test1 test2 test3\n"
  59. " EXTRA_INCLUDE include.h\n"
  60. " FUNCTION function)\n"
  61. "A test driver is a program that links together many small tests into "
  62. "a single executable. This is useful when building static executables "
  63. "with large libraries to shrink the total required size. "
  64. "The list of source files "
  65. "needed to build the testdriver will be in SourceListName. "
  66. "DriverName is the name of the test driver program. The rest of "
  67. "the arguments consist of a list of test source files, can be "
  68. "; separated. Each test source file should have a function in it that "
  69. "is the same name as the file with no extension (foo.cxx should have "
  70. "int foo();) DriverName will be able to call each of the tests by "
  71. "name on the command line. If EXTRA_INCLUDE is specified, then the "
  72. "next argument is included into the generated file. If FUNCTION is "
  73. "specified, then the next argument is taken as a function name that "
  74. "is passed a pointer to ac and av. This can be used to add extra "
  75. "command line processing to each test. The cmake variable "
  76. "CMAKE_TESTDRIVER_BEFORE_TESTMAIN can be set to have code that will be "
  77. "placed directly before calling the test main function. "
  78. "CMAKE_TESTDRIVER_AFTER_TESTMAIN can be set to have code that will be "
  79. "placed directly after the call to the test main function.";
  80. }
  81. cmTypeMacro(cmCreateTestSourceList, cmCommand);
  82. };
  83. #endif