cmCTestCoverageCommand.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 cmCTestCoverageCommand_h
  11. #define cmCTestCoverageCommand_h
  12. #include "cmCTestHandlerCommand.h"
  13. /** \class cmCTestCoverage
  14. * \brief Run a ctest script
  15. *
  16. * cmCTestCoverageCommand defineds the command to test the project.
  17. */
  18. class cmCTestCoverageCommand : public cmCTestHandlerCommand
  19. {
  20. public:
  21. cmCTestCoverageCommand();
  22. /**
  23. * This is a virtual constructor for the command.
  24. */
  25. virtual cmCommand* Clone()
  26. {
  27. cmCTestCoverageCommand* ni = new cmCTestCoverageCommand;
  28. ni->CTest = this->CTest;
  29. ni->CTestScriptHandler = this->CTestScriptHandler;
  30. return ni;
  31. }
  32. /**
  33. * The name of the command as specified in CMakeList.txt.
  34. */
  35. virtual const char* GetName() const { return "ctest_coverage";}
  36. /**
  37. * Succinct documentation.
  38. */
  39. virtual const char* GetTerseDocumentation() const
  40. {
  41. return "Collect coverage tool results.";
  42. }
  43. /**
  44. * More documentation.
  45. */
  46. virtual const char* GetFullDocumentation() const
  47. {
  48. return
  49. " ctest_coverage([BUILD build_dir] [RETURN_VALUE res] [APPEND]\n"
  50. " [LABELS label1 [label2 [...]]])\n"
  51. "Perform the coverage of the given build directory and stores results "
  52. "in Coverage.xml. The second argument is a variable that will hold "
  53. "value."
  54. "\n"
  55. "The LABELS option filters the coverage report to include only "
  56. "source files labeled with at least one of the labels specified."
  57. "\n"
  58. CTEST_COMMAND_APPEND_OPTION_DOCS;
  59. }
  60. cmTypeMacro(cmCTestCoverageCommand, cmCTestHandlerCommand);
  61. protected:
  62. cmCTestGenericHandler* InitializeHandler();
  63. virtual bool CheckArgumentKeyword(std::string const& arg);
  64. virtual bool CheckArgumentValue(std::string const& arg);
  65. enum
  66. {
  67. ArgumentDoingLabels = Superclass::ArgumentDoingLast1,
  68. ArgumentDoingLast2
  69. };
  70. bool LabelsMentioned;
  71. std::set<cmStdString> Labels;
  72. };
  73. #endif