Coverage Report

Created: 2026-03-12 06:35

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 "cmGeneratorExpression.h"
9
#include "cmGeneratorTarget.h"
10
#include "cmGlobalGenerator.h"
11
#include "cmListFileCache.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 file_permissions,
18
  std::vector<std::string> const& configurations, std::string const& component,
19
  MessageLevel message, bool exclude_from_all, bool optional,
20
  cmListFileBacktrace backtrace)
21
0
  : cmInstallGenerator(dest, configurations, component, message,
22
0
                       exclude_from_all, false, std::move(backtrace))
23
0
  , TargetName(std::move(target))
24
0
  , FilePermissions(std::move(file_permissions))
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
std::string cmInstallCxxModuleBmiGenerator::GetScriptLocation(
47
  std::string const& config) const
48
0
{
49
0
  char const* config_name = config.c_str();
50
0
  if (config.empty()) {
51
0
    config_name = "noconfig";
52
0
  }
53
0
  return cmStrCat(this->Target->GetCMFSupportDirectory(),
54
0
                  "/install-cxx-module-bmi-", config_name, ".cmake");
55
0
}
56
57
std::string cmInstallCxxModuleBmiGenerator::GetDestination(
58
  std::string const& config) const
59
0
{
60
0
  return cmGeneratorExpression::Evaluate(this->Destination,
61
0
                                         this->LocalGenerator, config);
62
0
}
63
64
void cmInstallCxxModuleBmiGenerator::GenerateScriptForConfig(
65
  std::ostream& os, std::string const& config, Indent indent)
66
0
{
67
0
  auto const& loc = this->GetScriptLocation(config);
68
0
  if (loc.empty()) {
69
0
    return;
70
0
  }
71
0
  os << indent << "include(" << cmScriptGenerator::Quote(loc)
72
0
     << " OPTIONAL)\n";
73
0
}