/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 | 0 | std::string const& GetType() const { return this->Type; } |
28 | | cm::FileSetMetadata::Visibility GetVisibility() const |
29 | 0 | { |
30 | 0 | return this->Visibility; |
31 | 0 | } |
32 | | |
33 | 0 | cmMakefile* GetMakefile() const { return this->Makefile; } |
34 | | |
35 | | bool IsForSelf() const |
36 | 0 | { |
37 | 0 | return cm::FileSetMetadata::VisibilityIsForSelf(this->GetVisibility()); |
38 | 0 | } |
39 | | bool IsForInterface() const |
40 | 0 | { |
41 | 0 | return cm::FileSetMetadata::VisibilityIsForInterface( |
42 | 0 | this->GetVisibility()); |
43 | 0 | } |
44 | | bool CanBeIncluded() const |
45 | 0 | { |
46 | 0 | return this->Type != cm::FileSetMetadata::CXX_MODULES; |
47 | 0 | } |
48 | | |
49 | | void CopyEntries(cmFileSet const* fs); |
50 | | |
51 | | void ClearDirectoryEntries(); |
52 | | void AddDirectoryEntry(BT<std::string> directories); |
53 | | std::vector<BT<std::string>> const& GetDirectoryEntries() const |
54 | 0 | { |
55 | 0 | return this->DirectoryEntries; |
56 | 0 | } |
57 | | |
58 | | void ClearFileEntries(); |
59 | | void AddFileEntry(BT<std::string> files); |
60 | | std::vector<BT<std::string>> const& GetFileEntries() const |
61 | 0 | { |
62 | 0 | return this->FileEntries; |
63 | 0 | } |
64 | | |
65 | | // Special properties |
66 | | cmBTStringRange GetIncludeDirectories() const; |
67 | | cmBTStringRange GetInterfaceIncludeDirectories() const; |
68 | | |
69 | | cmBTStringRange GetCompileOptions() const; |
70 | | cmBTStringRange GetInterfaceCompileOptions() const; |
71 | | |
72 | | cmBTStringRange GetCompileDefinitions() const; |
73 | | cmBTStringRange GetInterfaceCompileDefinitions() const; |
74 | | |
75 | | //! Set/Get a property of this file set |
76 | | void SetProperty(std::string const& prop, cmValue value); |
77 | | void SetProperty(std::string const& prop, std::nullptr_t) |
78 | 0 | { |
79 | 0 | this->SetProperty(prop, cmValue{ nullptr }); |
80 | 0 | } |
81 | | void RemoveProperty(std::string const& prop) |
82 | 0 | { |
83 | 0 | this->SetProperty(prop, cmValue{ nullptr }); |
84 | 0 | } |
85 | | void SetProperty(std::string const& prop, std::string const& value) |
86 | 0 | { |
87 | 0 | this->SetProperty(prop, cmValue{ value }); |
88 | 0 | } |
89 | | void AppendProperty(std::string const& prop, std::string const& value, |
90 | | bool asString = false); |
91 | | cmValue GetProperty(std::string const& prop) const; |
92 | | |
93 | | private: |
94 | | cmMakefile* Makefile; |
95 | | cmTarget* Target; |
96 | | std::string Name; |
97 | | std::string Type; |
98 | | cm::FileSetMetadata::Visibility Visibility; |
99 | | std::vector<BT<std::string>> DirectoryEntries; |
100 | | std::vector<BT<std::string>> FileEntries; |
101 | | cmPropertyMap Properties; |
102 | | std::vector<BT<std::string>> IncludeDirectories; |
103 | | std::vector<BT<std::string>> InterfaceIncludeDirectories; |
104 | | std::vector<BT<std::string>> CompileOptions; |
105 | | std::vector<BT<std::string>> InterfaceCompileOptions; |
106 | | std::vector<BT<std::string>> CompileDefinitions; |
107 | | std::vector<BT<std::string>> InterfaceCompileDefinitions; |
108 | | }; |