Coverage Report

Created: 2026-10-28 06:38

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/CMake/Source/cmInstallCxxModuleBmiGenerator.cxx
Line
Count
Source
1
/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
2
   file LICENSE.rst or https://cmake.org/licensing for details.  */
3
#include "cmInstallCxxModuleBmiGenerator.h"
4
5
#include <ostream>
6
#include <utility>
7
8
#include "cmDiagnosticContext.h"
9
#include "cmGeneratorExpression.h"
10
#include "cmGeneratorTarget.h"
11
#include "cmGlobalGenerator.h"
12
#include "cmLocalGenerator.h"
13
#include "cmScriptGenerator.h"
14
#include "cmStringAlgorithms.h"
15
16
cmInstallCxxModuleBmiGenerator::cmInstallCxxModuleBmiGenerator(
17
  std::string target, std::string const& dest, std::string filePermissions,
18
  std::vector<std::string> const& configurations, std::string const& component,
19
  MessageLevel message, bool excludeFromAll, bool optional,
20
  cmDiagnosticContext context)
21
0
  : cmInstallGenerator(dest, configurations, component, message,
22
0
                       excludeFromAll, false, std::move(context))
23
0
  , TargetName(std::move(target))
24
0
  , FilePermissions(std::move(filePermissions))
25
0
  , Optional(optional)
26
0
{
27
0
  this->ActionsPerConfig = true;
28
0
}
29
30
0
cmInstallCxxModuleBmiGenerator::~cmInstallCxxModuleBmiGenerator() = default;
31
32
bool cmInstallCxxModuleBmiGenerator::Compute(cmLocalGenerator* lg)
33
0
{
34
0
  this->LocalGenerator = lg;
35
36
0
  this->Target = lg->FindLocalNonAliasGeneratorTarget(this->TargetName);
37
0
  if (!this->Target) {
38
    // If no local target has been found, find it in the global scope.
39
0
    this->Target =
40
0
      lg->GetGlobalGenerator()->FindGeneratorTarget(this->TargetName);
41
0
  }
42
43
0
  return true;
44
0
}
45
46
void cmInstallCxxModuleBmiGenerator::GetInstallBuildDependencies(
47
  std::string const& config, std::vector<BuildDependency>& dependencies) const
48
0
{
49
0
  if (this->Target && this->Target->HaveInterfaceCxx20ModuleSources() &&
50
0
      !this->GetDestination(config).empty()) {
51
0
    dependencies.push_back({ this->Target, BuildDependencyType::Normal });
52
0
  }
53
0
}
54
55
std::string cmInstallCxxModuleBmiGenerator::GetScriptLocation(
56
  std::string const& config) const
57
0
{
58
0
  char const* configName = config.c_str();
59
0
  if (config.empty()) {
60
0
    configName = "noconfig";
61
0
  }
62
63
0
  return cmStrCat(this->Target->GetCMFSupportDirectory(),
64
0
                  "/install-cxx-module-bmi-", configName, ".cmake");
65
0
}
66
67
std::string cmInstallCxxModuleBmiGenerator::GetDestination(
68
  std::string const& config) const
69
0
{
70
0
  std::string dest = cmGeneratorExpression::Evaluate(
71
0
    this->Destination, this->LocalGenerator, config);
72
0
  this->CheckAbsoluteDestination(dest, this->LocalGenerator);
73
0
  return dest;
74
0
}
75
76
void cmInstallCxxModuleBmiGenerator::GenerateScriptForConfig(
77
  std::ostream& os, std::string const& config, Indent indent)
78
0
{
79
0
  auto const& loc = this->GetScriptLocation(config);
80
0
  if (loc.empty()) {
81
0
    return;
82
0
  }
83
0
  os << indent << "include(" << cmScriptGenerator::Quote(loc)
84
0
     << " OPTIONAL)\n";
85
0
}