mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-13 12:59:55 -05:00
export: Factor out CMake-specific export generation (2/2)
In order to support generation of Common Package Specifications, the mechanisms CMake uses to export package information need to be made more abstract. The prior commits began this refactoring; this continues by (actually) restructuring the classes used to generate the actual export files. To minimize churn, this introduces virtual base classes and diamond inheritance in order to separate logic which is format-agnostic but depends on the export mode (build-tree versus install-tree) from logic which is format-specific but mode-agnostic. This could probably be refactored further to use helper classes instead, and a future commit may do that, however an initial attempt to do that was proving even more invasive, such that this approach was deemed more manageable. While we're at it, add 'const' in more places where possible.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "cmExportFileGenerator.h"
|
||||
#include "cmExportCMakeConfigGenerator.h"
|
||||
|
||||
class cmFileSet;
|
||||
class cmGeneratorTarget;
|
||||
@@ -17,7 +17,7 @@ class cmGlobalGenerator;
|
||||
class cmMakefile;
|
||||
class cmTargetExport;
|
||||
|
||||
class cmExportTryCompileFileGenerator : public cmExportFileGenerator
|
||||
class cmExportTryCompileFileGenerator : public cmExportCMakeConfigGenerator
|
||||
{
|
||||
public:
|
||||
cmExportTryCompileFileGenerator(cmGlobalGenerator* gg,
|
||||
@@ -30,6 +30,10 @@ public:
|
||||
|
||||
protected:
|
||||
// Implement virtual methods from the superclass.
|
||||
void ComplainAboutDuplicateTarget(
|
||||
std::string const& /*targetName*/) const override{};
|
||||
void ReportError(std::string const& errorMessage) const override;
|
||||
|
||||
bool GenerateMainFile(std::ostream& os) override;
|
||||
|
||||
void GenerateImportTargetsConfig(std::ostream&, std::string const&,
|
||||
@@ -50,10 +54,10 @@ protected:
|
||||
|
||||
std::string GetFileSetDirectories(cmGeneratorTarget* target,
|
||||
cmFileSet* fileSet,
|
||||
cmTargetExport* te) override;
|
||||
cmTargetExport const* te) override;
|
||||
|
||||
std::string GetFileSetFiles(cmGeneratorTarget* target, cmFileSet* fileSet,
|
||||
cmTargetExport* te) override;
|
||||
cmTargetExport const* te) override;
|
||||
|
||||
std::string GetCxxModulesDirectory() const override { return {}; }
|
||||
void GenerateCxxModuleConfigInformation(std::string const&,
|
||||
|
||||
Reference in New Issue
Block a user