cmExportInstallFileGenerator.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #ifndef cmExportInstallFileGenerator_h
  11. #define cmExportInstallFileGenerator_h
  12. #include "cmExportFileGenerator.h"
  13. class cmInstallExportGenerator;
  14. class cmInstallFilesGenerator;
  15. class cmInstallTargetGenerator;
  16. class cmTargetExport;
  17. class cmExportSet;
  18. /** \class cmExportInstallFileGenerator
  19. * \brief Generate a file exporting targets from an install tree.
  20. *
  21. * cmExportInstallFileGenerator generates files exporting targets from
  22. * install an installation tree. The files are placed in a temporary
  23. * location for installation by cmInstallExportGenerator. One main
  24. * file is generated that creates the imported targets and loads
  25. * per-configuration files. Target locations and settings for each
  26. * configuration are written to these per-configuration files. After
  27. * installation the main file loads the configurations that have been
  28. * installed.
  29. *
  30. * This is used to implement the INSTALL(EXPORT) command.
  31. */
  32. class cmExportInstallFileGenerator: public cmExportFileGenerator
  33. {
  34. public:
  35. /** Construct with the export installer that will install the
  36. files. */
  37. cmExportInstallFileGenerator(cmInstallExportGenerator* iegen);
  38. /** Get the per-config file generated for each configuraiton. This
  39. maps from the configuration name to the file temporary location
  40. for installation. */
  41. std::map<cmStdString, cmStdString> const& GetConfigImportFiles()
  42. { return this->ConfigImportFiles; }
  43. /** Compute the globbing expression used to load per-config import
  44. files from the main file. */
  45. std::string GetConfigImportFileGlob();
  46. protected:
  47. // Implement virtual methods from the superclass.
  48. virtual bool GenerateMainFile(std::ostream& os);
  49. virtual void GenerateImportTargetsConfig(std::ostream& os,
  50. const char* config,
  51. std::string const& suffix);
  52. virtual void ComplainAboutMissingTarget(cmTarget* depender,
  53. cmTarget* dependee);
  54. /** Generate a per-configuration file for the targets. */
  55. bool GenerateImportFileConfig(const char* config);
  56. /** Fill in properties indicating installed file locations. */
  57. void SetImportLocationProperty(const char* config,
  58. std::string const& suffix,
  59. cmInstallTargetGenerator* itgen,
  60. ImportPropertyMap& properties,
  61. std::set<std::string>& importedLocations
  62. );
  63. void ComplainAboutImportPrefix(cmInstallTargetGenerator* itgen);
  64. cmInstallExportGenerator* IEGen;
  65. std::string ImportPrefix;
  66. // The import file generated for each configuration.
  67. std::map<cmStdString, cmStdString> ConfigImportFiles;
  68. };
  69. #endif