cmake/Source/cmExportBuildFileGenerator.h

92 lines
3.1 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. */
2021-09-14 00:13:48 +02:00
#pragma once
2018-01-26 17:06:56 +01:00
#include "cmConfigure.h" // IWYU pragma: keep
2016-10-30 18:24:19 +01:00
#include <iosfwd>
#include <string>
2020-02-01 23:06:01 +01:00
#include <utility>
2016-10-30 18:24:19 +01:00
#include <vector>
2020-08-30 11:54:41 +02:00
#include <cmext/algorithm>
2020-02-01 23:06:01 +01:00
#include "cmExportFileGenerator.h"
#include "cmStateTypes.h"
2014-08-03 19:52:23 +02:00
class cmExportSet;
2022-03-29 21:10:50 +02:00
class cmFileSet;
2016-10-30 18:24:19 +01:00
class cmGeneratorTarget;
class cmGlobalGenerator;
class cmLocalGenerator;
2022-03-29 21:10:50 +02:00
class cmTargetExport;
/** \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.
*
2022-08-04 22:12:04 +02:00
* 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
{
2020-08-30 11:54:41 +02:00
cm::append(this->Targets, targets);
2016-07-09 11:21:54 +02:00
}
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;
2022-08-04 22:12:04 +02:00
void GenerateImportTargetsConfig(std::ostream& os, const std::string& config,
std::string const& suffix) 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,
2021-11-20 13:41:27 +01:00
cmGeneratorTarget const* depender,
2018-01-26 17:06:56 +01:00
cmGeneratorTarget* dependee) override;
2013-03-16 19:13:01 +02:00
2021-11-20 13:41:27 +01:00
void ComplainAboutMissingTarget(cmGeneratorTarget const* depender,
cmGeneratorTarget const* dependee,
2020-02-01 23:06:01 +01:00
std::vector<std::string> const& namespaces);
/** 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);
2021-11-20 13:41:27 +01:00
std::string InstallNameDir(cmGeneratorTarget const* target,
2018-01-26 17:06:56 +01:00
const std::string& config) override;
2013-11-03 12:27:13 +02:00
2022-03-29 21:10:50 +02:00
std::string GetFileSetDirectories(cmGeneratorTarget* gte, cmFileSet* fileSet,
cmTargetExport* te) override;
std::string GetFileSetFiles(cmGeneratorTarget* gte, cmFileSet* fileSet,
cmTargetExport* te) override;
2020-02-01 23:06:01 +01:00
std::pair<std::vector<std::string>, std::string> FindBuildExportInfo(
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;
};