MCPcopy Create free account
hub / github.com/Kitware/CMake / addFileSetEntry

Function addFileSetEntry

Source/cmGeneratorTarget_Sources.cxx:83–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83void addFileSetEntry(cmGeneratorTarget const* headTarget,
84 cm::GenEx::Context const& context,
85 cmGeneratorExpressionDAGChecker* dagChecker,
86 cmFileSet const* fileSet,
87 EvaluatedTargetPropertyEntries& entries)
88{
89 auto dirCges = fileSet->CompileDirectoryEntries();
90 auto dirs = fileSet->EvaluateDirectoryEntries(dirCges, context, headTarget,
91 dagChecker);
92 bool contextSensitiveDirs = false;
93 for (auto const& dirCge : dirCges) {
94 if (dirCge->GetHadContextSensitiveCondition()) {
95 contextSensitiveDirs = true;
96 break;
97 }
98 }
99 cmake* cm = headTarget->GetLocalGenerator()->GetCMakeInstance();
100 for (auto& entryCge : fileSet->CompileFileEntries()) {
101 auto targetPropEntry =
102 cmGeneratorTarget::TargetPropertyEntry::CreateFileSet(
103 dirs, contextSensitiveDirs, std::move(entryCge), fileSet);
104 entries.Entries.emplace_back(EvaluateTargetPropertyEntry(
105 headTarget, context, dagChecker, *targetPropEntry));
106 EvaluatedTargetPropertyEntry const& entry = entries.Entries.back();
107 for (auto const& file : entry.Values) {
108 auto* sf = headTarget->Makefile->GetOrCreateSource(file);
109 if (fileSet->GetType() == "HEADERS"_s) {
110 sf->SetProperty("HEADER_FILE_ONLY", "TRUE");
111 }
112
113#ifndef CMAKE_BOOTSTRAP
114 std::string e;
115 std::string w;
116 auto path = sf->ResolveFullPath(&e, &w);
117 if (!w.empty()) {
118 cm->IssueMessage(MessageType::AUTHOR_WARNING, w, entry.Backtrace);
119 }
120 if (path.empty()) {
121 if (!e.empty()) {
122 cm->IssueMessage(MessageType::FATAL_ERROR, e, entry.Backtrace);
123 }
124 return;
125 }
126 bool found = false;
127 for (auto const& sg : headTarget->Makefile->GetSourceGroups()) {
128 if (sg->MatchChildrenFiles(path)) {
129 found = true;
130 break;
131 }
132 }
133 if (!found) {
134 if (fileSet->GetType() == "HEADERS"_s) {
135 headTarget->Makefile->GetOrCreateSourceGroup("Header Files")
136 ->AddGroupFile(path);
137 }
138 }
139#endif
140 }

Callers 1

AddFileSetEntriesFunction · 0.85

Calls 15

moveFunction · 0.85
CompileFileEntriesMethod · 0.80
emplace_backMethod · 0.80
GetOrCreateSourceMethod · 0.80
MatchChildrenFilesMethod · 0.80
AddGroupFileMethod · 0.80
GetCMakeInstanceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…