Coverage Report

Created: 2026-03-12 06:35

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/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 "cmFileSetMetadata.h"
12
#include "cmListFileCache.h"
13
#include "cmPropertyMap.h"
14
#include "cmValue.h"
15
16
class cmMakefile;
17
class cmTarget;
18
19
class cmFileSet
20
{
21
public:
22
  cmFileSet(cmMakefile* makefile, cmTarget* target, std::string name,
23
            std::string type, cm::FileSetMetadata::Visibility visibility);
24
25
0
  std::string const& GetName() const { return this->Name; }
26
0
  std::string const& GetType() const { return this->Type; }
27
  cm::FileSetMetadata::Visibility GetVisibility() const
28
0
  {
29
0
    return this->Visibility;
30
0
  }
31
32
0
  cmMakefile* GetMakefile() const { return this->Makefile; }
33
34
  bool IsForSelf() const
35
0
  {
36
0
    return cm::FileSetMetadata::VisibilityIsForSelf(this->GetVisibility());
37
0
  }
38
  bool IsForInterface() const
39
0
  {
40
0
    return cm::FileSetMetadata::VisibilityIsForInterface(
41
0
      this->GetVisibility());
42
0
  }
43
  bool CanBeIncluded() const
44
0
  {
45
0
    return this->Type == cm::FileSetMetadata::HEADERS;
46
0
  }
47
48
  void CopyEntries(cmFileSet const* fs);
49
50
  void ClearDirectoryEntries();
51
  void AddDirectoryEntry(BT<std::string> directories);
52
  std::vector<BT<std::string>> const& GetDirectoryEntries() const
53
0
  {
54
0
    return this->DirectoryEntries;
55
0
  }
56
57
  void ClearFileEntries();
58
  void AddFileEntry(BT<std::string> files);
59
  std::vector<BT<std::string>> const& GetFileEntries() const
60
0
  {
61
0
    return this->FileEntries;
62
0
  }
63
64
  //! Set/Get a property of this file set
65
  void SetProperty(std::string const& prop, cmValue value);
66
  void SetProperty(std::string const& prop, std::nullptr_t)
67
0
  {
68
0
    this->SetProperty(prop, cmValue{ nullptr });
69
0
  }
70
  void RemoveProperty(std::string const& prop)
71
0
  {
72
0
    this->SetProperty(prop, cmValue{ nullptr });
73
0
  }
74
  void SetProperty(std::string const& prop, std::string const& value)
75
0
  {
76
0
    this->SetProperty(prop, cmValue{ value });
77
0
  }
78
  void AppendProperty(std::string const& prop, std::string const& value,
79
                      bool asString = false);
80
  cmValue GetProperty(std::string const& prop) const;
81
82
private:
83
  cmMakefile* Makefile;
84
  cmTarget* Target;
85
  std::string Name;
86
  std::string Type;
87
  cm::FileSetMetadata::Visibility Visibility;
88
  std::vector<BT<std::string>> DirectoryEntries;
89
  std::vector<BT<std::string>> FileEntries;
90
  cmPropertyMap Properties;
91
  std::vector<BT<std::string>> CompileOptions;
92
  std::vector<BT<std::string>> CompileDefinitions;
93
  std::vector<BT<std::string>> IncludeDirectories;
94
};