cmExportInstallFileGenerator.h 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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 cmInstallTargetGenerator;
  15. /** \class cmExportInstallFileGenerator
  16. * \brief Generate a file exporting targets from an install tree.
  17. *
  18. * cmExportInstallFileGenerator generates files exporting targets from
  19. * install an installation tree. The files are placed in a temporary
  20. * location for installation by cmInstallExportGenerator. One main
  21. * 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 cmExportInstallFileGenerator: public cmExportFileGenerator
  30. {
  31. public:
  32. /** Construct with the export installer that will install the
  33. files. */
  34. cmExportInstallFileGenerator(cmInstallExportGenerator* iegen);
  35. /** Get the per-config file generated for each configuraiton. This
  36. maps from the configuration name to the file temporary location
  37. for installation. */
  38. std::map<std::string, std::string> const& GetConfigImportFiles()
  39. { return this->ConfigImportFiles; }
  40. /** Compute the globbing expression used to load per-config import
  41. files from the main file. */
  42. std::string GetConfigImportFileGlob();
  43. protected:
  44. // Implement virtual methods from the superclass.
  45. virtual bool GenerateMainFile(std::ostream& os);
  46. virtual void GenerateImportTargetsConfig(std::ostream& os,
  47. const std::string& config,
  48. std::string const& suffix,
  49. std::vector<std::string> &missingTargets);
  50. virtual void HandleMissingTarget(std::string& link_libs,
  51. std::vector<std::string>& missingTargets,
  52. cmGeneratorTarget* depender,
  53. cmGeneratorTarget* dependee);
  54. virtual void ReplaceInstallPrefix(std::string &input);
  55. void ComplainAboutMissingTarget(cmGeneratorTarget* depender,
  56. cmGeneratorTarget* dependee,
  57. int occurrences);
  58. std::vector<std::string> FindNamespaces(cmGlobalGenerator* gg,
  59. const std::string& name);
  60. /** Generate a per-configuration file for the targets. */
  61. bool GenerateImportFileConfig(const std::string& config,
  62. std::vector<std::string> &missingTargets);
  63. /** Fill in properties indicating installed file locations. */
  64. void SetImportLocationProperty(const std::string& config,
  65. std::string const& suffix,
  66. cmInstallTargetGenerator* itgen,
  67. ImportPropertyMap& properties,
  68. std::set<std::string>& importedLocations
  69. );
  70. std::string InstallNameDir(cmGeneratorTarget* target,
  71. const std::string& config);
  72. cmInstallExportGenerator* IEGen;
  73. // The import file generated for each configuration.
  74. std::map<std::string, std::string> ConfigImportFiles;
  75. };
  76. #endif