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

Method GetFileSetDirectory

Source/cmExportInstallPackageInfoGenerator.cxx:221–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

219}
220
221cm::optional<std::string>
222cmExportInstallPackageInfoGenerator::GetFileSetDirectory(
223 cmGeneratorTarget* gte, cmTargetExport const* te, cmFileSet* fileSet,
224 cm::optional<std::string> const& config)
225{
226 cmGeneratorExpression ge(*gte->Makefile->GetCMakeInstance());
227 auto cge =
228 ge.Parse(te->FileSetGenerators.at(fileSet->GetName())->GetDestination());
229
230 std::string const unescapedDest =
231 cge->Evaluate(gte->LocalGenerator, config.value_or(""), gte);
232 bool const isConfigDependent = cge->GetHadContextSensitiveCondition();
233
234 if (config && !isConfigDependent) {
235 return {};
236 }
237 if (!config && isConfigDependent) {
238 this->RequiresConfigFiles = true;
239 return {};
240 }
241
242 std::string const& type = fileSet->GetType();
243 if (config && (type == "CXX_MODULES"_s)) {
244 // C++ modules do not support interface file sets which are dependent
245 // upon the configuration.
246 cmMakefile* mf = gte->LocalGenerator->GetMakefile();
247 std::ostringstream e;
248 e << "The \"" << gte->GetName() << "\" target's interface file set \""
249 << fileSet->GetName() << "\" of type \"" << type
250 << "\" contains context-sensitive base file entries which is not "
251 "supported.";
252 mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
253 return {};
254 }
255
256 cm::optional<std::string> dest = cmOutputConverter::EscapeForCMake(
257 unescapedDest, cmOutputConverter::WrapQuotes::NoWrap);
258
259 if (!cmSystemTools::FileIsFullPath(unescapedDest)) {
260 dest = cmStrCat("@prefix@/"_s, *dest);
261 }
262
263 return dest;
264}
265
266bool cmExportInstallPackageInfoGenerator::GenerateFileSetProperties(
267 Json::Value& component, cmGeneratorTarget* gte, cmTargetExport const* te,

Callers 1

Calls 12

strMethod · 0.80
cmStrCatFunction · 0.70
GetCMakeInstanceMethod · 0.45
ParseMethod · 0.45
GetDestinationMethod · 0.45
atMethod · 0.45
GetNameMethod · 0.45
EvaluateMethod · 0.45
GetTypeMethod · 0.45
GetMakefileMethod · 0.45
IssueMessageMethod · 0.45

Tested by

no test coverage detected