cmake/Source/CTest/cmCTestCoverageCommand.cxx

47 lines
1.3 KiB
C++
Raw Normal View History

2016-10-30 18:24:19 +01:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCTestCoverageCommand.h"
2020-02-01 23:06:01 +01:00
#include <set>
2020-08-30 11:54:41 +02:00
#include <cmext/algorithm>
#include <cmext/string_view>
2020-02-01 23:06:01 +01:00
#include "cmCTest.h"
2009-10-04 10:30:41 +03:00
#include "cmCTestCoverageHandler.h"
2016-10-30 18:24:19 +01:00
class cmCTestGenericHandler;
2020-02-01 23:06:01 +01:00
void cmCTestCoverageCommand::BindArguments()
{
this->cmCTestHandlerCommand::BindArguments();
this->Bind("LABELS"_s, this->Labels);
}
void cmCTestCoverageCommand::CheckArguments(
std::vector<std::string> const& keywords)
2009-10-04 10:30:41 +03:00
{
2020-02-01 23:06:01 +01:00
this->LabelsMentioned =
2020-08-30 11:54:41 +02:00
!this->Labels.empty() || cm::contains(keywords, "LABELS");
2009-10-04 10:30:41 +03:00
}
cmCTestGenericHandler* cmCTestCoverageCommand::InitializeHandler()
{
2016-07-09 11:21:54 +02:00
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "CoverageCommand", "CTEST_COVERAGE_COMMAND", this->Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "CoverageExtraFlags", "CTEST_COVERAGE_EXTRA_FLAGS",
this->Quiet);
2019-11-11 23:01:05 +01:00
cmCTestCoverageHandler* handler = this->CTest->GetCoverageHandler();
handler->Initialize();
2009-10-04 10:30:41 +03:00
// If a LABELS option was given, select only files with the labels.
2016-07-09 11:21:54 +02:00
if (this->LabelsMentioned) {
2020-02-01 23:06:01 +01:00
handler->SetLabelFilter(
std::set<std::string>(this->Labels.begin(), this->Labels.end()));
2016-07-09 11:21:54 +02:00
}
2009-10-04 10:30:41 +03:00
2015-08-17 11:37:30 +02:00
handler->SetQuiet(this->Quiet);
return handler;
}