1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmExportInstallFileGenerator.h,v $
6 Date: $Date: 2008-02-01 13:56:00 $
7 Version: $Revision: 1.2 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #ifndef cmExportInstallFileGenerator_h
18 #define cmExportInstallFileGenerator_h
20 #include "cmExportFileGenerator.h"
22 class cmInstallExportGenerator
;
23 class cmInstallFilesGenerator
;
24 class cmInstallTargetGenerator
;
27 /** \class cmExportInstallFileGenerator
28 * \brief Generate a file exporting targets from an install tree.
30 * cmExportInstallFileGenerator generates files exporting targets from
31 * install an installation tree. The files are placed in a temporary
32 * location for installation by cmInstallExportGenerator. One main
33 * file is generated that creates the imported targets and loads
34 * per-configuration files. Target locations and settings for each
35 * configuration are written to these per-configuration files. After
36 * installation the main file loads the configurations that have been
39 * This is used to implement the INSTALL(EXPORT) command.
41 class cmExportInstallFileGenerator
: public cmExportFileGenerator
44 /** Construct with the export installer that will install the
46 cmExportInstallFileGenerator(cmInstallExportGenerator
* iegen
);
48 /** Set the name of the export associated with the files. This is
49 the name given to the install(EXPORT) command mode. */
50 void SetName(const char* name
) { this->Name
= name
; }
52 /** Set the set of targets to be exported. These are the targets
53 associated with the export name. */
54 void SetExportSet(std::vector
<cmTargetExport
*> const* eSet
)
55 { this->ExportSet
= eSet
; }
57 /** Get the per-config file generated for each configuraiton. This
58 maps from the configuration name to the file temporary location
60 std::map
<cmStdString
, cmStdString
> const& GetConfigImportFiles()
61 { return this->ConfigImportFiles
; }
64 // Implement virtual methods from the superclass.
65 virtual bool GenerateMainFile(std::ostream
& os
);
66 virtual void GenerateImportTargetsConfig(std::ostream
& os
,
68 std::string
const& suffix
);
69 virtual void ComplainAboutMissingTarget(cmTarget
* depender
,
72 /** Generate a per-configuration file for the targets. */
73 bool GenerateImportFileConfig(const char* config
);
75 /** Fill in properties indicating installed file locations. */
76 void SetImportLocationProperty(const char* config
,
77 std::string
const& suffix
,
78 cmInstallTargetGenerator
* itgen
,
79 ImportPropertyMap
& properties
);
81 void ComplainAboutImportPrefix(cmInstallTargetGenerator
* itgen
);
83 cmInstallExportGenerator
* InstallExportGenerator
;
85 std::vector
<cmTargetExport
*> const* ExportSet
;
87 std::string ImportPrefix
;
89 // The import file generated for each configuration.
90 std::map
<cmStdString
, cmStdString
> ConfigImportFiles
;
94 cmTargetExport is used in cmGlobalGenerator to collect the install
95 generators for targets associated with an export.
100 cmTargetExport(cmTarget
* tgt
,
101 cmInstallTargetGenerator
* archive
,
102 cmInstallTargetGenerator
* runtime
,
103 cmInstallTargetGenerator
* library
,
104 cmInstallTargetGenerator
* framework
,
105 cmInstallTargetGenerator
* bundle
,
106 cmInstallFilesGenerator
* headers
107 ) : Target(tgt
), ArchiveGenerator(archive
),
108 RuntimeGenerator(runtime
), LibraryGenerator(library
),
109 FrameworkGenerator(framework
), BundleGenerator(bundle
),
110 HeaderGenerator(headers
) {}
113 cmInstallTargetGenerator
* ArchiveGenerator
;
114 cmInstallTargetGenerator
* RuntimeGenerator
;
115 cmInstallTargetGenerator
* LibraryGenerator
;
116 cmInstallTargetGenerator
* FrameworkGenerator
;
117 cmInstallTargetGenerator
* BundleGenerator
;
118 cmInstallFilesGenerator
* HeaderGenerator
;