Coverage Report

Created: 2026-02-09 06:05

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/CMake/Source/cmExportInstallCMakeConfigGenerator.h
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
#pragma once
4
5
#include "cmConfigure.h" // IWYU pragma: keep
6
7
#include <iosfwd>
8
#include <string>
9
10
#include "cmExportCMakeConfigGenerator.h"
11
#include "cmExportInstallFileGenerator.h"
12
13
class cmInstallExportGenerator;
14
15
/** \class cmExportInstallCMakeConfigGenerator
16
 * \brief Generate files exporting targets from an install tree.
17
 *
18
 * cmExportInstallCMakeConfigGenerator generates files exporting targets from
19
 * an installation tree.  The files are placed in a temporary location for
20
 * installation by cmInstallExportGenerator.  The file format is CMake's native
21
 * package configuration format.
22
 *
23
 * One main file is generated that creates the imported targets and loads
24
 * per-configuration files.  Target locations and settings for each
25
 * configuration are written to these per-configuration files.  After
26
 * installation the main file loads the configurations that have been
27
 * installed.
28
 *
29
 * This is used to implement the INSTALL(EXPORT) command.
30
 */
31
class cmExportInstallCMakeConfigGenerator
32
  : public cmExportCMakeConfigGenerator
33
  , public cmExportInstallFileGenerator
34
{
35
public:
36
  /** Construct with the export installer that will install the
37
      files.  */
38
  cmExportInstallCMakeConfigGenerator(cmInstallExportGenerator* iegen);
39
40
  /** Compute the globbing expression used to load per-config import
41
      files from the main file.  */
42
  std::string GetConfigImportFileGlob() const override;
43
44
protected:
45
  // Implement virtual methods from the superclass.
46
  bool GenerateMainFile(std::ostream& os) override;
47
  void GenerateImportTargetsConfig(std::ostream& os, std::string const& config,
48
                                   std::string const& suffix) override;
49
  void GenerateImportConfig(std::ostream& os,
50
                            std::string const& config) override;
51
52
0
  char GetConfigFileNameSeparator() const override { return '-'; }
53
54
  /** Generate the relative import prefix.  */
55
  virtual void GenerateImportPrefix(std::ostream&);
56
57
  /** Generate the relative import prefix.  */
58
  virtual void LoadConfigFiles(std::ostream&);
59
60
  virtual void CleanupTemporaryVariables(std::ostream&);
61
62
  std::string GetFileSetDirectories(cmGeneratorTarget* gte, cmFileSet* fileSet,
63
                                    cmTargetExport const* te) override;
64
  std::string GetFileSetFiles(cmGeneratorTarget* gte, cmFileSet* fileSet,
65
                              cmTargetExport const* te) override;
66
67
  std::string GetCxxModulesDirectory() const override;
68
  void GenerateCxxModuleConfigInformation(std::string const&,
69
                                          std::ostream&) const override;
70
  bool GenerateImportCxxModuleConfigTargetInclusion(std::string const&,
71
                                                    std::string const&);
72
};