/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 | | class TargetPropertyEntry; |
14 | | |
15 | | namespace GenEx { |
16 | | struct Context; |
17 | | } |
18 | | } |
19 | | |
20 | | class cmLinkItem; |
21 | | struct cmGeneratorExpressionDAGChecker; |
22 | | |
23 | | // Represent a target property entry after evaluating generator expressions |
24 | | // and splitting up lists. |
25 | | struct EvaluatedTargetPropertyEntry |
26 | | { |
27 | | EvaluatedTargetPropertyEntry(cmLinkItem const& item, cmListFileBacktrace bt); |
28 | | |
29 | | // Move-only. |
30 | 0 | EvaluatedTargetPropertyEntry(EvaluatedTargetPropertyEntry&&) = default; |
31 | | EvaluatedTargetPropertyEntry(EvaluatedTargetPropertyEntry const&) = delete; |
32 | | EvaluatedTargetPropertyEntry& operator=(EvaluatedTargetPropertyEntry&&) = |
33 | | delete; |
34 | | EvaluatedTargetPropertyEntry& operator=( |
35 | | EvaluatedTargetPropertyEntry const&) = delete; |
36 | | |
37 | | cmLinkItem const& LinkItem; |
38 | | cmListFileBacktrace Backtrace; |
39 | | std::vector<std::string> Values; |
40 | | bool ContextDependent = false; |
41 | | }; |
42 | | |
43 | | EvaluatedTargetPropertyEntry EvaluateTargetPropertyEntry( |
44 | | cmGeneratorTarget const* thisTarget, cm::GenEx::Context const& context, |
45 | | cmGeneratorExpressionDAGChecker* dagChecker, cm::TargetPropertyEntry& entry); |
46 | | |
47 | | struct EvaluatedTargetPropertyEntries |
48 | | { |
49 | | std::vector<EvaluatedTargetPropertyEntry> Entries; |
50 | | bool HadContextSensitiveCondition = false; |
51 | | }; |
52 | | |
53 | | EvaluatedTargetPropertyEntries EvaluateTargetPropertyEntries( |
54 | | cmGeneratorTarget const* thisTarget, cm::GenEx::Context const& context, |
55 | | cmGeneratorExpressionDAGChecker* dagChecker, |
56 | | std::vector<std::unique_ptr<cm::TargetPropertyEntry>> const& 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); |