summaryrefslogtreecommitdiffstats
path: root/Source/cmStateDirectory.h
blob: 8c6b09dfba3b49a01da87efe7215c5e2d532c9ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
   file Copyright.txt or https://cmake.org/licensing for details.  */

#pragma once

#include "cmConfigure.h" // IWYU pragma: keep

#include <string>
#include <vector>

#include "cmAlgorithms.h"
#include "cmLinkedTree.h"
#include "cmStatePrivate.h"
#include "cmStateSnapshot.h"
#include "cmValue.h"

class cmListFileBacktrace;
template <typename T>
class BT;

class cmStateDirectory
{
  cmStateDirectory(
    cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator iter,
    cmStateSnapshot const& snapshot);

public:
  std::string const& GetCurrentSource() const;
  void SetCurrentSource(std::string const& dir);
  std::string const& GetCurrentBinary() const;
  void SetCurrentBinary(std::string const& dir);

  cmBTStringRange GetIncludeDirectoriesEntries() const;
  void AppendIncludeDirectoriesEntry(BT<std::string> const& vec);
  void PrependIncludeDirectoriesEntry(BT<std::string> const& vec);
  void SetIncludeDirectories(BT<std::string> const& vec);
  void ClearIncludeDirectories();

  cmBTStringRange GetCompileDefinitionsEntries() const;
  void AppendCompileDefinitionsEntry(BT<std::string> const& vec);
  void SetCompileDefinitions(BT<std::string> const& vec);
  void ClearCompileDefinitions();

  cmBTStringRange GetCompileOptionsEntries() const;
  void AppendCompileOptionsEntry(BT<std::string> const& vec);
  void SetCompileOptions(BT<std::string> const& vec);
  void ClearCompileOptions();

  cmBTStringRange GetLinkOptionsEntries() const;
  void AppendLinkOptionsEntry(BT<std::string> const& vec);
  void PrependLinkDirectoriesEntry(BT<std::string> const& vec);
  void SetLinkOptions(BT<std::string> const& vec);
  void ClearLinkOptions();

  cmBTStringRange GetLinkDirectoriesEntries() const;
  void AppendLinkDirectoriesEntry(BT<std::string> const& vec);
  void SetLinkDirectories(BT<std::string> const& vecs);
  void ClearLinkDirectories();

  void SetProperty(const std::string& prop, const char* value,
                   cmListFileBacktrace const& lfbt);
  void SetProperty(const std::string& prop, cmValue value,
                   cmListFileBacktrace const& lfbt);
  void AppendProperty(const std::string& prop, const std::string& value,
                      bool asString, cmListFileBacktrace const& lfbt);
  cmValue GetProperty(const std::string& prop) const;
  cmValue GetProperty(const std::string& prop, bool chain) const;
  bool GetPropertyAsBool(const std::string& prop) const;
  std::vector<std::string> GetPropertyKeys() const;

  void AddNormalTargetName(std::string const& name);
  void AddImportedTargetName(std::string const& name);

private:
  template <typename ValueType>
  void StoreProperty(const std::string& prop, ValueType value,
                     cmListFileBacktrace const& lfbt);

  cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator
    DirectoryState;
  cmStateSnapshot Snapshot_;
  friend class cmStateSnapshot;
};