cmake/Source/cmExportSet.h

94 lines
2.4 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
2013-03-16 19:13:01 +02:00
2017-07-20 19:35:53 +02:00
#include "cmConfigure.h" // IWYU pragma: keep
2016-10-30 18:24:19 +01:00
2020-02-01 23:06:01 +01:00
#include <map>
#include <memory>
2016-10-30 18:24:19 +01:00
#include <string>
#include <vector>
2016-07-09 11:21:54 +02:00
2024-04-14 22:45:38 +02:00
#include <cm/optional>
2013-03-16 19:13:01 +02:00
class cmInstallExportGenerator;
2016-03-13 13:35:51 +01:00
class cmLocalGenerator;
2016-10-30 18:24:19 +01:00
class cmTargetExport;
2013-03-16 19:13:01 +02:00
/// A set of targets that were installed with the same EXPORT parameter.
class cmExportSet
{
public:
/// Construct an empty export set named \a name
2020-02-01 23:06:01 +01:00
cmExportSet(std::string name);
2013-03-16 19:13:01 +02:00
/// Destructor
~cmExportSet();
2019-11-11 23:01:05 +01:00
cmExportSet(const cmExportSet&) = delete;
cmExportSet& operator=(const cmExportSet&) = delete;
2022-07-29 21:54:54 +02:00
bool Compute(cmLocalGenerator* lg);
2016-03-13 13:35:51 +01:00
2020-02-01 23:06:01 +01:00
void AddTargetExport(std::unique_ptr<cmTargetExport> tgt);
2013-03-16 19:13:01 +02:00
void AddInstallation(cmInstallExportGenerator const* installation);
2024-04-14 22:45:38 +02:00
void SetXcFrameworkLocation(const std::string& name,
const std::string& location);
2013-03-16 19:13:01 +02:00
std::string const& GetName() const { return this->Name; }
2020-02-01 23:06:01 +01:00
std::vector<std::unique_ptr<cmTargetExport>> const& GetTargetExports() const
2016-07-09 11:21:54 +02:00
{
2020-02-01 23:06:01 +01:00
return this->TargetExports;
2016-07-09 11:21:54 +02:00
}
2013-03-16 19:13:01 +02:00
std::vector<cmInstallExportGenerator const*> const* GetInstallations() const
2016-07-09 11:21:54 +02:00
{
return &this->Installations;
}
2013-03-16 19:13:01 +02:00
2024-04-14 22:45:38 +02:00
enum class PackageDependencyExportEnabled
{
Auto,
Off,
On,
};
struct PackageDependency
{
PackageDependencyExportEnabled Enabled =
PackageDependencyExportEnabled::Auto;
std::vector<std::string> ExtraArguments;
cm::optional<unsigned int> SpecifiedIndex;
cm::optional<unsigned int> FindPackageIndex;
};
PackageDependency& GetPackageDependencyForSetup(const std::string& name);
const std::map<std::string, PackageDependency>& GetPackageDependencies()
const
{
return this->PackageDependencies;
}
2013-03-16 19:13:01 +02:00
private:
2020-02-01 23:06:01 +01:00
std::vector<std::unique_ptr<cmTargetExport>> TargetExports;
2013-03-16 19:13:01 +02:00
std::string Name;
std::vector<cmInstallExportGenerator const*> Installations;
2024-04-14 22:45:38 +02:00
std::map<std::string, PackageDependency> PackageDependencies;
unsigned int NextPackageDependencyIndex = 0;
2013-03-16 19:13:01 +02:00
};
2020-02-01 23:06:01 +01:00
/// A name -> cmExportSet map with overloaded operator[].
class cmExportSetMap : public std::map<std::string, cmExportSet>
{
public:
/** \brief Overloaded operator[].
*
* The operator is overloaded because cmExportSet has no default constructor:
* we do not want unnamed export sets.
*/
cmExportSet& operator[](const std::string& name);
};