cmake/Source/cmExportBuildFileGenerator.h

87 lines
2.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 cmExportBuildFileGenerator_h
#define cmExportBuildFileGenerator_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 <string>
#include <vector>
2014-08-03 19:52:23 +02:00
class cmExportSet;
2016-10-30 18:24:19 +01:00
class cmGeneratorTarget;
class cmGlobalGenerator;
class cmLocalGenerator;
/** \class cmExportBuildFileGenerator
* \brief Generate a file exporting targets from a build tree.
*
* cmExportBuildFileGenerator generates a file exporting targets from
* a build tree. A single file exports information for all
* configurations built.
*
* This is used to implement the EXPORT() command.
*/
2016-07-09 11:21:54 +02:00
class cmExportBuildFileGenerator : public cmExportFileGenerator
{
public:
cmExportBuildFileGenerator();
/** Set the list of targets to export. */
2014-08-03 19:52:23 +02:00
void SetTargets(std::vector<std::string> const& targets)
2016-07-09 11:21:54 +02:00
{
this->Targets = targets;
}
void GetTargets(std::vector<std::string>& targets) const;
2014-08-03 19:52:23 +02:00
void AppendTargets(std::vector<std::string> const& targets)
2016-07-09 11:21:54 +02:00
{
this->Targets.insert(this->Targets.end(), targets.begin(), targets.end());
}
2014-08-03 19:52:23 +02:00
void SetExportSet(cmExportSet*);
/** Set whether to append generated code to the output file. */
void SetAppendMode(bool append) { this->AppendMode = append; }
2016-03-13 13:35:51 +01:00
void Compute(cmLocalGenerator* lg);
2014-08-03 19:52:23 +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(
cmGeneratorTarget const* target) 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
2016-03-13 13:35:51 +01:00
void ComplainAboutMissingTarget(cmGeneratorTarget* depender,
cmGeneratorTarget* dependee,
2014-08-03 19:52:23 +02:00
int occurrences);
/** Fill in properties indicating built file locations. */
2015-04-27 22:25:09 +02:00
void SetImportLocationProperty(const std::string& config,
std::string const& suffix,
2015-11-17 17:22:37 +01:00
cmGeneratorTarget* target,
ImportPropertyMap& properties);
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
2016-07-09 11:21:54 +02:00
std::vector<std::string> FindNamespaces(cmGlobalGenerator* gg,
const std::string& name);
2014-08-03 19:52:23 +02:00
std::vector<std::string> Targets;
2016-07-09 11:21:54 +02:00
cmExportSet* ExportSet;
2015-11-17 17:22:37 +01:00
std::vector<cmGeneratorTarget*> Exports;
2016-03-13 13:35:51 +01:00
cmLocalGenerator* LG;
};
#endif