/src/CMake/Source/cmFileSet.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 <cstddef> |
6 | | #include <string> |
7 | | #include <vector> |
8 | | |
9 | | #include <cm/string_view> |
10 | | |
11 | | #include "cmAlgorithms.h" |
12 | | #include "cmFileSetMetadata.h" |
13 | | #include "cmListFileCache.h" |
14 | | #include "cmPropertyMap.h" |
15 | | #include "cmValue.h" |
16 | | |
17 | | class cmMakefile; |
18 | | class cmTarget; |
19 | | |
20 | | class cmFileSet |
21 | | { |
22 | | public: |
23 | | cmFileSet(cmMakefile* makefile, cmTarget* target, std::string name, |
24 | | std::string type, cm::FileSetMetadata::Visibility visibility); |
25 | | |
26 | 0 | std::string const& GetName() const { return this->Name; } |
27 | 5.92k | std::string const& GetType() const { return this->Type; } |
28 | 6.93k | cm::FileSetMetadata::FileSetDomain GetDomain() const { return this->Domain; } |
29 | | cm::FileSetMetadata::Visibility GetVisibility() const |
30 | 0 | { |
31 | 0 | return this->Visibility; |
32 | 0 | } |
33 | | |
34 | 0 | cmMakefile* GetMakefile() const { return this->Makefile; } |
35 | | |
36 | | bool IsForSelf() const |
37 | 0 | { |
38 | 0 | return cm::FileSetMetadata::VisibilityIsForSelf(this->GetVisibility()); |
39 | 0 | } |
40 | | bool IsForInterface() const |
41 | 0 | { |
42 | 0 | return cm::FileSetMetadata::VisibilityIsForInterface( |
43 | 0 | this->GetVisibility()); |
44 | 0 | } |
45 | | bool CanBeIncluded() const |
46 | 0 | { |
47 | 0 | return this->Type != cm::FileSetMetadata::CXX_MODULES; |
48 | 0 | } |
49 | | |
50 | | void CopyEntries(cmFileSet const* fs); |
51 | | |
52 | | void ClearDirectoryEntries(); |
53 | | void AddDirectoryEntry(BT<std::string> directories); |
54 | | std::vector<BT<std::string>> const& GetDirectoryEntries() const |
55 | 0 | { |
56 | 0 | return this->DirectoryEntries; |
57 | 0 | } |
58 | | |
59 | | void ClearFileEntries(); |
60 | | void AddFileEntry(BT<std::string> files); |
61 | | std::vector<BT<std::string>> const& GetFileEntries() const |
62 | 0 | { |
63 | 0 | return this->FileEntries; |
64 | 0 | } |
65 | | |
66 | | // Special properties |
67 | | cmBTStringRange GetIncludeDirectories() const; |
68 | | cmBTStringRange GetInterfaceIncludeDirectories() const; |
69 | | |
70 | | cmBTStringRange GetCompileOptions() const; |
71 | | cmBTStringRange GetInterfaceCompileOptions() const; |
72 | | |
73 | | cmBTStringRange GetCompileDefinitions() const; |
74 | | cmBTStringRange GetInterfaceCompileDefinitions() const; |
75 | | |
76 | | //! Set/Get a property of this file set |
77 | | void SetProperty(std::string const& prop, cmValue value); |
78 | | void SetProperty(std::string const& prop, std::nullptr_t) |
79 | 0 | { |
80 | 0 | this->SetProperty(prop, cmValue{ nullptr }); |
81 | 0 | } |
82 | | void RemoveProperty(std::string const& prop) |
83 | 0 | { |
84 | 0 | this->SetProperty(prop, cmValue{ nullptr }); |
85 | 0 | } |
86 | | void SetProperty(std::string const& prop, std::string const& value) |
87 | 0 | { |
88 | 0 | this->SetProperty(prop, cmValue{ value }); |
89 | 0 | } |
90 | | void AppendProperty(std::string const& prop, std::string const& value, |
91 | | bool asString = false); |
92 | | cmValue GetProperty(std::string const& prop) const; |
93 | | |
94 | | private: |
95 | | cmMakefile* Makefile; |
96 | | cmTarget* Target; |
97 | | std::string Name; |
98 | | std::string Type; |
99 | | cm::FileSetMetadata::FileSetDomain Domain; |
100 | | cm::FileSetMetadata::Visibility Visibility; |
101 | | std::vector<BT<std::string>> DirectoryEntries; |
102 | | std::vector<BT<std::string>> FileEntries; |
103 | | cmPropertyMap Properties; |
104 | | std::vector<BT<std::string>> IncludeDirectories; |
105 | | std::vector<BT<std::string>> InterfaceIncludeDirectories; |
106 | | std::vector<BT<std::string>> CompileOptions; |
107 | | std::vector<BT<std::string>> InterfaceCompileOptions; |
108 | | std::vector<BT<std::string>> CompileDefinitions; |
109 | | std::vector<BT<std::string>> InterfaceCompileDefinitions; |
110 | | }; |