cmExportInstallFileGenerator.h 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. /** Set the name of the export associated with the files. This is
  39. the name given to the install(EXPORT) command mode. */
  40. void SetName(const char* name) { this->Name = name; }
  41. /** Set the set of targets to be exported. These are the targets
  42. associated with the export name. */
  43. void SetExportSet(cmExportSet const* eSet)
  44. { this->ExportSet = eSet; }
  45. /** Get the per-config file generated for each configuraiton. This
  46. maps from the configuration name to the file temporary location
  47. for installation. */
  48. std::map<cmStdString, cmStdString> const& GetConfigImportFiles()
  49. { return this->ConfigImportFiles; }
  50. /** Compute the globbing expression used to load per-config import
  51. files from the main file. */
  52. std::string GetConfigImportFileGlob();
  53. protected:
  54. // Implement virtual methods from the superclass.
  55. virtual bool GenerateMainFile(std::ostream& os);
  56. virtual void GenerateImportTargetsConfig(std::ostream& os,
  57. const char* config,
  58. std::string const& suffix);
  59. virtual void ComplainAboutMissingTarget(cmTarget* depender,
  60. cmTarget* dependee);
  61. /** Generate a per-configuration file for the targets. */
  62. bool GenerateImportFileConfig(const char* config);
  63. /** Fill in properties indicating installed file locations. */
  64. void SetImportLocationProperty(const char* config,
  65. std::string const& suffix,
  66. cmInstallTargetGenerator* itgen,
  67. ImportPropertyMap& properties,
  68. std::set<std::string>& importedLocations
  69. );
  70. void ComplainAboutImportPrefix(cmInstallTargetGenerator* itgen);
  71. cmInstallExportGenerator* InstallExportGenerator;
  72. std::string Name;
  73. cmExportSet const* ExportSet;
  74. std::string ImportPrefix;
  75. // The import file generated for each configuration.
  76. std::map<cmStdString, cmStdString> ConfigImportFiles;
  77. };
  78. #endif