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