cmExportInstallPackageInfoGenerator.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. #include "cmConfigure.h" // IWYU pragma: keep
  5. #include <iosfwd>
  6. #include <string>
  7. #include "cmExportInstallFileGenerator.h"
  8. #include "cmExportPackageInfoGenerator.h"
  9. class cmGeneratorTarget;
  10. class cmInstallExportGenerator;
  11. class cmPackageInfoArguments;
  12. /** \class cmExportInstallPackageInfoGenerator
  13. * \brief Generate files exporting targets from an install tree.
  14. *
  15. * cmExportInstallPackageInfoGenerator generates files exporting targets from
  16. * an installation tree. The files are placed in a temporary location for
  17. * installation by cmInstallExportGenerator. The file format is the Common
  18. * Package Specification (https://cps-org.github.io/cps/).
  19. *
  20. * One main file is generated that describes the imported targets. Additional,
  21. * per-configuration files describe target locations and settings for each
  22. * configuration.
  23. *
  24. * This is used to implement the INSTALL(PACKAGE_INFO) command.
  25. */
  26. class cmExportInstallPackageInfoGenerator
  27. : public cmExportPackageInfoGenerator
  28. , public cmExportInstallFileGenerator
  29. {
  30. public:
  31. /** Construct with the export installer that will install the
  32. files. */
  33. cmExportInstallPackageInfoGenerator(cmInstallExportGenerator* iegen,
  34. cmPackageInfoArguments arguments);
  35. /** Compute the globbing expression used to load per-config import
  36. files from the main file. */
  37. std::string GetConfigImportFileGlob() const override;
  38. protected:
  39. std::string const& GetExportName() const override;
  40. // Implement virtual methods from the superclass.
  41. bool GenerateMainFile(std::ostream& os) override;
  42. void GenerateImportTargetsConfig(std::ostream& os, std::string const& config,
  43. std::string const& suffix) override;
  44. char GetConfigFileNameSeparator() const override { return '@'; }
  45. /** Generate the cps_path, which determines the import prefix. */
  46. std::string GenerateImportPrefix() const;
  47. std::string InstallNameDir(cmGeneratorTarget const* target,
  48. std::string const& config) override;
  49. std::string GetCxxModulesDirectory() const override;
  50. // TODO: Generate C++ module info in a not-CMake-specific format.
  51. };