1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-12 08:42:47 +08:00
CMake/Source/cmExportBuildAndroidMKGenerator.h
Matthew Woehlke 20fa4ce8d8 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.
2024-07-23 12:13:39 -04:00

48 lines
1.5 KiB
C++

/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
#include <iosfwd>
#include <string>
#include "cmExportAndroidMKGenerator.h"
#include "cmExportBuildFileGenerator.h"
#include "cmStateTypes.h"
class cmGeneratorTarget;
/** \class cmExportBuildAndroidMKGenerator
* \brief Generate a file exporting targets from a build tree.
*
* cmExportBuildAndroidMKGenerator generates a file exporting targets from
* a build tree. This exports the targets to the Android ndk build tool
* makefile format for prebuilt libraries.
*
* This is used to implement the export() command.
*/
class cmExportBuildAndroidMKGenerator
: public cmExportBuildFileGenerator
, public cmExportAndroidMKGenerator
{
public:
cmExportBuildAndroidMKGenerator();
/** Set whether to append generated code to the output file. */
void SetAppendMode(bool append) { this->AppendMode = append; }
protected:
GenerateType GetGenerateType() const override { return BUILD; }
// Implement virtual methods from the superclass.
bool GenerateMainFile(std::ostream& os) override;
void GenerateImportHeaderCode(std::ostream& os,
std::string const& config = "") override;
void GenerateImportTargetCode(
std::ostream& os, cmGeneratorTarget const* target,
cmStateEnums::TargetType /*targetType*/) override;
std::string GetCxxModulesDirectory() const override { return {}; }
};