cmCTestCoverageCommand.cxx 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 <set>
  5. #include <cmext/algorithm>
  6. #include <cmext/string_view>
  7. #include "cmCTest.h"
  8. #include "cmCTestCoverageHandler.h"
  9. class cmCTestGenericHandler;
  10. void cmCTestCoverageCommand::BindArguments()
  11. {
  12. this->cmCTestHandlerCommand::BindArguments();
  13. this->Bind("LABELS"_s, this->Labels);
  14. }
  15. void cmCTestCoverageCommand::CheckArguments(
  16. std::vector<std::string> const& keywords)
  17. {
  18. this->LabelsMentioned =
  19. !this->Labels.empty() || cm::contains(keywords, "LABELS");
  20. }
  21. cmCTestGenericHandler* cmCTestCoverageCommand::InitializeHandler()
  22. {
  23. this->CTest->SetCTestConfigurationFromCMakeVariable(
  24. this->Makefile, "CoverageCommand", "CTEST_COVERAGE_COMMAND", this->Quiet);
  25. this->CTest->SetCTestConfigurationFromCMakeVariable(
  26. this->Makefile, "CoverageExtraFlags", "CTEST_COVERAGE_EXTRA_FLAGS",
  27. this->Quiet);
  28. cmCTestCoverageHandler* handler = this->CTest->GetCoverageHandler();
  29. handler->Initialize();
  30. // If a LABELS option was given, select only files with the labels.
  31. if (this->LabelsMentioned) {
  32. handler->SetLabelFilter(
  33. std::set<std::string>(this->Labels.begin(), this->Labels.end()));
  34. }
  35. handler->SetQuiet(this->Quiet);
  36. return handler;
  37. }