Files
cmake/Source/cmExportBuildPackageInfoGenerator.h
Matthew Woehlke a5b38fb898 CPS: Implement exporting of file sets
Add (partial) file set export to CPS. For now, only headers ("includes")
are supported, as that is the only overlap with the specification.
(Source file sets are not supported by CPS at this time, and the hope is
that C++ modules will never be supported, as that information should
already be available via the `cpp_module_metadata` information.) CPS
also supports "embeds", but CMake doesn't (yet).

This also introduces our first official use of CPS extensions, used to
record the CMake file set name.
2026-06-30 15:08:02 -04:00

59 lines
1.9 KiB
C++

/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
#include <iosfwd>
#include <string>
#include "cmExportBuildFileGenerator.h"
#include "cmExportPackageInfoGenerator.h"
namespace Json {
class Value;
}
class cmDiagnosticContext;
class cmGeneratorTarget;
class cmPackageInfoArguments;
/** \class cmExportBuildPackageInfoGenerator
* \brief Generate a file exporting targets from a build tree.
*
* cmExportBuildCMakeConfigGenerator generates a file exporting targets from
* a build tree. This exports the targets to the Common Package Specification
* (https://cps-org.github.io/cps/).
*
* This is used to implement the export() command.
*/
class cmExportBuildPackageInfoGenerator
: public cmExportBuildFileGenerator
, public cmExportPackageInfoGenerator
{
public:
cmExportBuildPackageInfoGenerator(cmPackageInfoArguments arguments,
cmDiagnosticContext context);
protected:
// Implement virtual methods from the superclass.
bool GenerateMainFile(std::ostream& os) override;
void GenerateImportTargetsConfig(std::ostream&, std::string const&,
std::string const&) override
{
}
void GenerateInterfacePropertiesConfig(Json::Value& configurations,
cmGeneratorTarget* target,
std::string const& config);
std::string GetCxxModulesDirectory() const override;
using cmExportPackageInfoGenerator::GenerateTargetFileSets;
void GenerateTargetFileSets(Json::Value& fileSets,
cmGeneratorTarget const* target,
cmGeneratorFileSet const* fileSet,
cmTargetExport const* targetExport,
std::string const& type) const override;
};