cmExportInstallCMakeConfigGenerator.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #pragma once
  4. #include "cmConfigure.h" // IWYU pragma: keep
  5. #include <iosfwd>
  6. #include <string>
  7. #include "cmExportCMakeConfigGenerator.h"
  8. #include "cmExportInstallFileGenerator.h"
  9. class cmFileSet;
  10. class cmGeneratorTarget;
  11. class cmInstallExportGenerator;
  12. class cmTargetExport;
  13. /** \class cmExportInstallCMakeConfigGenerator
  14. * \brief Generate files exporting targets from an install tree.
  15. *
  16. * cmExportInstallCMakeConfigGenerator generates files exporting targets from
  17. * an installation tree. The files are placed in a temporary location for
  18. * installation by cmInstallExportGenerator. The file format is CMake's native
  19. * package configuration format.
  20. *
  21. * One main file is generated that creates the imported targets and loads
  22. * per-configuration files. Target locations and settings for each
  23. * configuration are written to these per-configuration files. After
  24. * installation the main file loads the configurations that have been
  25. * installed.
  26. *
  27. * This is used to implement the INSTALL(EXPORT) command.
  28. */
  29. class cmExportInstallCMakeConfigGenerator
  30. : public cmExportCMakeConfigGenerator
  31. , public cmExportInstallFileGenerator
  32. {
  33. public:
  34. /** Construct with the export installer that will install the
  35. files. */
  36. cmExportInstallCMakeConfigGenerator(cmInstallExportGenerator* iegen);
  37. /** Compute the globbing expression used to load per-config import
  38. files from the main file. */
  39. std::string GetConfigImportFileGlob() const override;
  40. protected:
  41. // Implement virtual methods from the superclass.
  42. bool GenerateMainFile(std::ostream& os) override;
  43. void GenerateImportTargetsConfig(std::ostream& os, std::string const& config,
  44. std::string const& suffix) override;
  45. /** Generate the relative import prefix. */
  46. virtual void GenerateImportPrefix(std::ostream&);
  47. /** Generate the relative import prefix. */
  48. virtual void LoadConfigFiles(std::ostream&);
  49. virtual void CleanupTemporaryVariables(std::ostream&);
  50. /** Generate a per-configuration file for the targets. */
  51. virtual bool GenerateImportFileConfig(std::string const& config);
  52. std::string GetFileSetDirectories(cmGeneratorTarget* gte, cmFileSet* fileSet,
  53. cmTargetExport const* te) override;
  54. std::string GetFileSetFiles(cmGeneratorTarget* gte, cmFileSet* fileSet,
  55. cmTargetExport const* te) override;
  56. std::string GetCxxModulesDirectory() const override;
  57. void GenerateCxxModuleConfigInformation(std::string const&,
  58. std::ostream&) const override;
  59. bool GenerateImportCxxModuleConfigTargetInclusion(std::string const&,
  60. std::string const&);
  61. };