cmCTestCoverageCommand.cxx 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #include "cmCTestCoverageCommand.h"
  4. #include "cmCTest.h"
  5. #include "cmCTestCoverageHandler.h"
  6. class cmCTestGenericHandler;
  7. cmCTestCoverageCommand::cmCTestCoverageCommand()
  8. {
  9. this->LabelsMentioned = false;
  10. }
  11. cmCTestGenericHandler* cmCTestCoverageCommand::InitializeHandler()
  12. {
  13. this->CTest->SetCTestConfigurationFromCMakeVariable(
  14. this->Makefile, "CoverageCommand", "CTEST_COVERAGE_COMMAND", this->Quiet);
  15. this->CTest->SetCTestConfigurationFromCMakeVariable(
  16. this->Makefile, "CoverageExtraFlags", "CTEST_COVERAGE_EXTRA_FLAGS",
  17. this->Quiet);
  18. cmCTestCoverageHandler* handler = this->CTest->GetCoverageHandler();
  19. handler->Initialize();
  20. // If a LABELS option was given, select only files with the labels.
  21. if (this->LabelsMentioned) {
  22. handler->SetLabelFilter(this->Labels);
  23. }
  24. handler->SetQuiet(this->Quiet);
  25. return handler;
  26. }
  27. bool cmCTestCoverageCommand::CheckArgumentKeyword(std::string const& arg)
  28. {
  29. // Look for arguments specific to this command.
  30. if (arg == "LABELS") {
  31. this->ArgumentDoing = ArgumentDoingLabels;
  32. this->LabelsMentioned = true;
  33. return true;
  34. }
  35. // Look for other arguments.
  36. return this->Superclass::CheckArgumentKeyword(arg);
  37. }
  38. bool cmCTestCoverageCommand::CheckArgumentValue(std::string const& arg)
  39. {
  40. // Handle states specific to this command.
  41. if (this->ArgumentDoing == ArgumentDoingLabels) {
  42. this->Labels.insert(arg);
  43. return true;
  44. }
  45. // Look for other arguments.
  46. return this->Superclass::CheckArgumentValue(arg);
  47. }