/src/CMake/Source/cmExportSet.h
Line | Count | Source |
1 | | /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying |
2 | | file LICENSE.rst or https://cmake.org/licensing for details. */ |
3 | | #pragma once |
4 | | |
5 | | #include "cmConfigure.h" // IWYU pragma: keep |
6 | | |
7 | | #include <map> |
8 | | #include <memory> |
9 | | #include <string> |
10 | | #include <vector> |
11 | | |
12 | | #include <cm/optional> |
13 | | |
14 | | class cmInstallExportGenerator; |
15 | | class cmLocalGenerator; |
16 | | class cmTargetExport; |
17 | | |
18 | | /// A set of targets that were installed with the same EXPORT parameter. |
19 | | class cmExportSet |
20 | | { |
21 | | public: |
22 | | /// Construct an empty export set named \a name |
23 | | cmExportSet(std::string name); |
24 | | /// Destructor |
25 | | ~cmExportSet(); |
26 | | |
27 | | cmExportSet(cmExportSet const&) = delete; |
28 | | cmExportSet& operator=(cmExportSet const&) = delete; |
29 | | |
30 | | bool Compute(cmLocalGenerator* lg); |
31 | | |
32 | | void AddTargetExport(std::unique_ptr<cmTargetExport> tgt); |
33 | | |
34 | | void AddInstallation(cmInstallExportGenerator const* installation); |
35 | | |
36 | | void SetXcFrameworkLocation(std::string const& name, |
37 | | std::string const& location); |
38 | | |
39 | 0 | std::string const& GetName() const { return this->Name; } |
40 | | |
41 | | std::vector<std::unique_ptr<cmTargetExport>> const& GetTargetExports() const |
42 | 0 | { |
43 | 0 | return this->TargetExports; |
44 | 0 | } |
45 | | |
46 | | std::vector<cmInstallExportGenerator const*> const* GetInstallations() const |
47 | 0 | { |
48 | 0 | return &this->Installations; |
49 | 0 | } |
50 | | |
51 | | enum class PackageDependencyExportEnabled |
52 | | { |
53 | | Auto, |
54 | | Off, |
55 | | On, |
56 | | }; |
57 | | |
58 | | struct PackageDependency |
59 | | { |
60 | | PackageDependencyExportEnabled Enabled = |
61 | | PackageDependencyExportEnabled::Auto; |
62 | | std::vector<std::string> ExtraArguments; |
63 | | cm::optional<unsigned int> SpecifiedIndex; |
64 | | cm::optional<unsigned int> FindPackageIndex; |
65 | | }; |
66 | | |
67 | | PackageDependency& GetPackageDependencyForSetup(std::string const& name); |
68 | | |
69 | | std::map<std::string, PackageDependency> const& GetPackageDependencies() |
70 | | const |
71 | 0 | { |
72 | 0 | return this->PackageDependencies; |
73 | 0 | } |
74 | | |
75 | | private: |
76 | | std::vector<std::unique_ptr<cmTargetExport>> TargetExports; |
77 | | std::string Name; |
78 | | std::vector<cmInstallExportGenerator const*> Installations; |
79 | | std::map<std::string, PackageDependency> PackageDependencies; |
80 | | unsigned int NextPackageDependencyIndex = 0; |
81 | | }; |
82 | | |
83 | | /// A name -> cmExportSet map with overloaded operator[]. |
84 | | class cmExportSetMap : public std::map<std::string, cmExportSet> |
85 | | { |
86 | | public: |
87 | | /** \brief Overloaded operator[]. |
88 | | * |
89 | | * The operator is overloaded because cmExportSet has no default constructor: |
90 | | * we do not want unnamed export sets. |
91 | | */ |
92 | | cmExportSet& operator[](std::string const& name); |
93 | | }; |