cmCTestCoverageCommand.cxx 1.4 KB

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