Coverage Report

Created: 2026-04-29 07:01

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/CMake/Source/cmEvaluatedTargetProperty.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 <memory>
6
#include <string>
7
#include <vector>
8
9
#include <cm/string_view>
10
11
#include "cmGeneratorTarget.h"
12
#include "cmListFileCache.h"
13
14
namespace cm {
15
class TargetPropertyEntry;
16
17
namespace GenEx {
18
struct Context;
19
}
20
}
21
22
class cmLinkItem;
23
struct cmGeneratorExpressionDAGChecker;
24
25
namespace cm {
26
// Represent a target property entry after evaluating generator expressions
27
// and splitting up lists.
28
struct EvaluatedTargetPropertyEntry
29
{
30
  EvaluatedTargetPropertyEntry(cmLinkItem const& item, cmListFileBacktrace bt);
31
32
  // Move-only.
33
0
  EvaluatedTargetPropertyEntry(EvaluatedTargetPropertyEntry&&) = default;
34
  EvaluatedTargetPropertyEntry(EvaluatedTargetPropertyEntry const&) = delete;
35
  EvaluatedTargetPropertyEntry& operator=(EvaluatedTargetPropertyEntry&&) =
36
    delete;
37
  EvaluatedTargetPropertyEntry& operator=(
38
    EvaluatedTargetPropertyEntry const&) = delete;
39
40
  cmLinkItem const& LinkItem;
41
  cmListFileBacktrace Backtrace;
42
  std::vector<std::string> Values;
43
  bool ContextDependent = false;
44
};
45
46
EvaluatedTargetPropertyEntry EvaluateTargetPropertyEntry(
47
  cmGeneratorTarget const* thisTarget, cm::GenEx::Context const& context,
48
  cmGeneratorExpressionDAGChecker* dagChecker, cm::TargetPropertyEntry& entry);
49
50
struct EvaluatedTargetPropertyEntries
51
{
52
  std::vector<EvaluatedTargetPropertyEntry> Entries;
53
  bool HadContextSensitiveCondition = false;
54
};
55
56
EvaluatedTargetPropertyEntries EvaluateTargetPropertyEntries(
57
  cmGeneratorTarget const* thisTarget, cm::GenEx::Context const& context,
58
  cmGeneratorExpressionDAGChecker* dagChecker,
59
  std::vector<std::unique_ptr<cm::TargetPropertyEntry>> const& in);
60
61
// IncludeRuntimeInterface is used to break the cycle in computing
62
// the necessary transitive dependencies of targets that can occur
63
// now that we have implicit language runtime targets.
64
//
65
// To determine the set of languages that a target has we need to iterate
66
// all the sources which includes transitive INTERFACE sources.
67
// Therefore we can't determine what language runtimes are needed
68
// for a target until after all sources are computed.
69
//
70
// Therefore while computing the applicable INTERFACE_SOURCES we
71
// must ignore anything in LanguageRuntimeLibraries or we would
72
// create a cycle ( INTERFACE_SOURCES requires LanguageRuntimeLibraries,
73
// LanguageRuntimeLibraries requires INTERFACE_SOURCES).
74
//
75
enum class IncludeRuntimeInterface
76
{
77
  Yes,
78
  No
79
};
80
81
void AddInterfaceEntries(
82
  cmGeneratorTarget const* headTarget, std::string const& prop,
83
  cm::GenEx::Context const& context,
84
  cmGeneratorExpressionDAGChecker* dagChecker,
85
  EvaluatedTargetPropertyEntries& entries,
86
  IncludeRuntimeInterface searchRuntime,
87
  cmGeneratorTarget::UseTo usage = cmGeneratorTarget::UseTo::Compile);
88
89
void AddInterfaceFileSetsEntries(cmGeneratorTarget const* headTarget,
90
                                 cm::string_view type, std::string const& prop,
91
                                 cm::GenEx::Context const& context,
92
                                 cmGeneratorExpressionDAGChecker* dagChecker,
93
                                 EvaluatedTargetPropertyEntries& entries);
94
}