Coverage Report

Created: 2026-02-09 06:05

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 "cmOutputConverter.h"
14
#include "cmScriptGenerator.h"
15
#include "cmStringAlgorithms.h"
16
17
cmInstallCxxModuleBmiGenerator::cmInstallCxxModuleBmiGenerator(
18
  std::string target, std::string const& dest, std::string file_permissions,
19
  std::vector<std::string> const& configurations, std::string const& component,
20
  MessageLevel message, bool exclude_from_all, bool optional,
21
  cmListFileBacktrace backtrace)
22
0
  : cmInstallGenerator(dest, configurations, component, message,
23
0
                       exclude_from_all, false, std::move(backtrace))
24
0
  , TargetName(std::move(target))
25
0
  , FilePermissions(std::move(file_permissions))
26
0
  , Optional(optional)
27
0
{
28
0
  this->ActionsPerConfig = true;
29
0
}
30
31
0
cmInstallCxxModuleBmiGenerator::~cmInstallCxxModuleBmiGenerator() = default;
32
33
bool cmInstallCxxModuleBmiGenerator::Compute(cmLocalGenerator* lg)
34
0
{
35
0
  this->LocalGenerator = lg;
36
37
0
  this->Target = lg->FindLocalNonAliasGeneratorTarget(this->TargetName);
38
0
  if (!this->Target) {
39
    // If no local target has been found, find it in the global scope.
40
0
    this->Target =
41
0
      lg->GetGlobalGenerator()->FindGeneratorTarget(this->TargetName);
42
0
  }
43
44
0
  return true;
45
0
}
46
47
std::string cmInstallCxxModuleBmiGenerator::GetScriptLocation(
48
  std::string const& config) const
49
0
{
50
0
  char const* config_name = config.c_str();
51
0
  if (config.empty()) {
52
0
    config_name = "noconfig";
53
0
  }
54
0
  return cmStrCat(this->Target->GetCMFSupportDirectory(),
55
0
                  "/install-cxx-module-bmi-", config_name, ".cmake");
56
0
}
57
58
std::string cmInstallCxxModuleBmiGenerator::GetDestination(
59
  std::string const& config) const
60
0
{
61
0
  return cmGeneratorExpression::Evaluate(this->Destination,
62
0
                                         this->LocalGenerator, config);
63
0
}
64
65
void cmInstallCxxModuleBmiGenerator::GenerateScriptForConfig(
66
  std::ostream& os, std::string const& config, Indent indent)
67
0
{
68
0
  auto const& loc = this->GetScriptLocation(config);
69
0
  if (loc.empty()) {
70
0
    return;
71
0
  }
72
0
  os << indent << "include(\""
73
0
     << cmOutputConverter::EscapeForCMake(
74
0
          loc, cmOutputConverter::WrapQuotes::NoWrap)
75
0
     << "\" OPTIONAL)\n";
76
0
}