Coverage Report

Created: 2026-02-09 06:05

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