2016-09-27 19:01:08 +00:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2008-01-28 13:38:36 +00:00
|
|
|
#ifndef cmExportInstallFileGenerator_h
|
|
|
|
#define cmExportInstallFileGenerator_h
|
|
|
|
|
2016-09-01 18:59:28 +00:00
|
|
|
#include <cmConfigure.h>
|
|
|
|
|
2008-01-28 13:38:36 +00:00
|
|
|
#include "cmExportFileGenerator.h"
|
|
|
|
|
2016-09-01 18:59:28 +00:00
|
|
|
#include <iosfwd>
|
|
|
|
#include <map>
|
|
|
|
#include <set>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
class cmGeneratorTarget;
|
|
|
|
class cmGlobalGenerator;
|
2008-01-28 13:38:36 +00:00
|
|
|
class cmInstallExportGenerator;
|
|
|
|
class cmInstallTargetGenerator;
|
|
|
|
|
|
|
|
/** \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-05-16 14:34:04 +00:00
|
|
|
class cmExportInstallFileGenerator : public cmExportFileGenerator
|
2008-01-28 13:38:36 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** Construct with the export installer that will install the
|
|
|
|
files. */
|
|
|
|
cmExportInstallFileGenerator(cmInstallExportGenerator* iegen);
|
|
|
|
|
|
|
|
/** Get the per-config file generated for each configuraiton. This
|
|
|
|
maps from the configuration name to the file temporary location
|
|
|
|
for installation. */
|
2014-02-10 05:21:34 +00:00
|
|
|
std::map<std::string, std::string> const& GetConfigImportFiles()
|
2016-05-16 14:34:04 +00:00
|
|
|
{
|
|
|
|
return this->ConfigImportFiles;
|
|
|
|
}
|
2009-01-07 19:16:28 +00:00
|
|
|
|
|
|
|
/** Compute the globbing expression used to load per-config import
|
|
|
|
files from the main file. */
|
|
|
|
std::string GetConfigImportFileGlob();
|
2008-01-28 13:38:36 +00:00
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
protected:
|
2008-01-28 13:38:36 +00:00
|
|
|
// Implement virtual methods from the superclass.
|
2016-06-27 19:25:27 +00:00
|
|
|
bool GenerateMainFile(std::ostream& os) CM_OVERRIDE;
|
|
|
|
void GenerateImportTargetsConfig(
|
2016-05-16 14:34:04 +00:00
|
|
|
std::ostream& os, const std::string& config, std::string const& suffix,
|
2016-06-27 19:25:27 +00:00
|
|
|
std::vector<std::string>& missingTargets) CM_OVERRIDE;
|
|
|
|
void HandleMissingTarget(std::string& link_libs,
|
|
|
|
std::vector<std::string>& missingTargets,
|
|
|
|
cmGeneratorTarget* depender,
|
|
|
|
cmGeneratorTarget* dependee) CM_OVERRIDE;
|
2012-09-28 19:47:37 +00:00
|
|
|
|
2016-06-27 19:25:27 +00:00
|
|
|
void ReplaceInstallPrefix(std::string& input) CM_OVERRIDE;
|
2013-01-27 08:43:44 +00:00
|
|
|
|
2015-10-17 13:05:46 +00:00
|
|
|
void ComplainAboutMissingTarget(cmGeneratorTarget* depender,
|
|
|
|
cmGeneratorTarget* dependee,
|
2012-09-28 19:47:37 +00:00
|
|
|
int occurrences);
|
|
|
|
|
2015-10-17 13:01:25 +00:00
|
|
|
std::vector<std::string> FindNamespaces(cmGlobalGenerator* gg,
|
2012-09-28 19:47:37 +00:00
|
|
|
const std::string& name);
|
|
|
|
|
2016-07-12 17:26:55 +00:00
|
|
|
/** Generate the relative import prefix. */
|
2016-07-12 17:26:55 +00:00
|
|
|
virtual void GenerateImportPrefix(std::ostream&);
|
2016-07-12 17:26:55 +00:00
|
|
|
|
|
|
|
/** Generate the relative import prefix. */
|
2016-07-12 17:26:55 +00:00
|
|
|
virtual void LoadConfigFiles(std::ostream&);
|
2016-07-12 17:26:55 +00:00
|
|
|
|
2016-07-12 17:26:55 +00:00
|
|
|
virtual void CleanupTemporaryVariables(std::ostream&);
|
2016-07-12 17:26:55 +00:00
|
|
|
|
2008-01-28 13:38:36 +00:00
|
|
|
/** Generate a per-configuration file for the targets. */
|
2016-07-12 17:26:55 +00:00
|
|
|
virtual bool GenerateImportFileConfig(
|
|
|
|
const std::string& config, std::vector<std::string>& missingTargets);
|
2008-01-28 13:38:36 +00:00
|
|
|
|
|
|
|
/** Fill in properties indicating installed file locations. */
|
2014-02-10 03:48:34 +00:00
|
|
|
void SetImportLocationProperty(const std::string& config,
|
2008-01-28 13:38:36 +00:00
|
|
|
std::string const& suffix,
|
|
|
|
cmInstallTargetGenerator* itgen,
|
2011-11-12 17:12:07 +00:00
|
|
|
ImportPropertyMap& properties,
|
2016-05-16 14:34:04 +00:00
|
|
|
std::set<std::string>& importedLocations);
|
2008-01-28 13:38:36 +00:00
|
|
|
|
2015-08-04 17:19:47 +00:00
|
|
|
std::string InstallNameDir(cmGeneratorTarget* target,
|
2016-06-27 19:25:27 +00:00
|
|
|
const std::string& config) CM_OVERRIDE;
|
2013-05-20 22:57:58 +00:00
|
|
|
|
2012-03-01 10:52:32 +00:00
|
|
|
cmInstallExportGenerator* IEGen;
|
2008-01-28 13:38:36 +00:00
|
|
|
|
|
|
|
// The import file generated for each configuration.
|
2014-02-10 05:21:34 +00:00
|
|
|
std::map<std::string, std::string> ConfigImportFiles;
|
2008-01-28 13:38:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|