cmake/Source/cmExportInstallFileGenerator.h

107 lines
3.9 KiB
C
Raw Normal View History

2016-10-30 18:24:19 +01:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmExportInstallFileGenerator_h
#define cmExportInstallFileGenerator_h
2018-01-26 17:06:56 +01:00
#include "cmConfigure.h" // IWYU pragma: keep
2016-10-30 18:24:19 +01:00
#include "cmExportFileGenerator.h"
2018-08-09 18:06:22 +02:00
#include "cmStateTypes.h"
2016-10-30 18:24:19 +01:00
#include <iosfwd>
#include <map>
#include <set>
#include <string>
#include <vector>
class cmGeneratorTarget;
class cmGlobalGenerator;
class cmInstallExportGenerator;
class cmInstallTargetGenerator;
2018-08-09 18:06:22 +02:00
class cmTargetExport;
/** \class cmExportInstallFileGenerator
* \brief Generate a file exporting targets from an install tree.
*
* cmExportInstallFileGenerator generates files exporting targets from
* install an installation tree. The files are placed in a temporary
* location for installation by cmInstallExportGenerator. One main
* file is generated that creates the imported targets and loads
* per-configuration files. Target locations and settings for each
* configuration are written to these per-configuration files. After
* installation the main file loads the configurations that have been
* installed.
*
* This is used to implement the INSTALL(EXPORT) command.
*/
2016-07-09 11:21:54 +02:00
class cmExportInstallFileGenerator : public cmExportFileGenerator
{
public:
/** Construct with the export installer that will install the
files. */
cmExportInstallFileGenerator(cmInstallExportGenerator* iegen);
2018-08-09 18:06:22 +02:00
/** Get the per-config file generated for each configuration. This
maps from the configuration name to the file temporary location
for installation. */
2015-04-27 22:25:09 +02:00
std::map<std::string, std::string> const& GetConfigImportFiles()
2016-07-09 11:21:54 +02:00
{
return this->ConfigImportFiles;
}
/** Compute the globbing expression used to load per-config import
files from the main file. */
std::string GetConfigImportFileGlob();
2016-07-09 11:21:54 +02:00
protected:
// Implement virtual methods from the superclass.
2018-01-26 17:06:56 +01:00
bool GenerateMainFile(std::ostream& os) override;
2016-10-30 18:24:19 +01:00
void GenerateImportTargetsConfig(
2016-07-09 11:21:54 +02:00
std::ostream& os, const std::string& config, std::string const& suffix,
2018-01-26 17:06:56 +01:00
std::vector<std::string>& missingTargets) override;
2018-08-09 18:06:22 +02:00
cmStateEnums::TargetType GetExportTargetType(
cmTargetExport const* targetExport) const;
2016-10-30 18:24:19 +01:00
void HandleMissingTarget(std::string& link_libs,
std::vector<std::string>& missingTargets,
cmGeneratorTarget* depender,
2018-01-26 17:06:56 +01:00
cmGeneratorTarget* dependee) override;
2013-03-16 19:13:01 +02:00
2018-01-26 17:06:56 +01:00
void ReplaceInstallPrefix(std::string& input) override;
2013-03-16 19:13:01 +02:00
2016-03-13 13:35:51 +01:00
void ComplainAboutMissingTarget(cmGeneratorTarget* depender,
cmGeneratorTarget* dependee,
2013-03-16 19:13:01 +02:00
int occurrences);
2016-03-13 13:35:51 +01:00
std::vector<std::string> FindNamespaces(cmGlobalGenerator* gg,
2013-03-16 19:13:01 +02:00
const std::string& name);
2016-10-30 18:24:19 +01:00
/** Generate the relative import prefix. */
virtual void GenerateImportPrefix(std::ostream&);
/** Generate the relative import prefix. */
virtual void LoadConfigFiles(std::ostream&);
virtual void CleanupTemporaryVariables(std::ostream&);
/** Generate a per-configuration file for the targets. */
2016-10-30 18:24:19 +01:00
virtual bool GenerateImportFileConfig(
const std::string& config, std::vector<std::string>& missingTargets);
/** Fill in properties indicating installed file locations. */
2015-04-27 22:25:09 +02:00
void SetImportLocationProperty(const std::string& config,
std::string const& suffix,
cmInstallTargetGenerator* itgen,
2012-02-18 12:40:36 +02:00
ImportPropertyMap& properties,
2016-07-09 11:21:54 +02:00
std::set<std::string>& importedLocations);
2015-11-17 17:22:37 +01:00
std::string InstallNameDir(cmGeneratorTarget* target,
2018-01-26 17:06:56 +01:00
const std::string& config) override;
2013-11-03 12:27:13 +02:00
2013-03-16 19:13:01 +02:00
cmInstallExportGenerator* IEGen;
// The import file generated for each configuration.
2015-04-27 22:25:09 +02:00
std::map<std::string, std::string> ConfigImportFiles;
};
#endif