cmExportInstallFileGenerator.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. int occurrences);
  55. /** Generate a per-configuration file for the targets. */
  56. bool GenerateImportFileConfig(const char* config);
  57. /** Fill in properties indicating installed file locations. */
  58. void SetImportLocationProperty(const char* config,
  59. std::string const& suffix,
  60. cmInstallTargetGenerator* itgen,
  61. ImportPropertyMap& properties,
  62. std::set<std::string>& importedLocations
  63. );
  64. void ComplainAboutImportPrefix(cmInstallTargetGenerator* itgen);
  65. cmInstallExportGenerator* IEGen;
  66. std::string ImportPrefix;
  67. // The import file generated for each configuration.
  68. std::map<cmStdString, cmStdString> ConfigImportFiles;
  69. };
  70. #endif