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

Method GetOutputName

Source/cmGeneratorTarget.cxx:310–367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

308}
309
310std::string cmGeneratorTarget::GetOutputName(
311 std::string const& config, cmStateEnums::ArtifactType artifact) const
312{
313 // Lookup/compute/cache the output name for this configuration.
314 OutputNameKey key(config, artifact);
315 auto i = this->OutputNameMap.find(key);
316 if (i == this->OutputNameMap.end()) {
317 // Add empty name in map to detect potential recursion.
318 OutputNameMapType::value_type entry(key, "");
319 i = this->OutputNameMap.insert(entry).first;
320
321 // Compute output name.
322 std::vector<std::string> props;
323 std::string type = this->GetOutputTargetType(artifact);
324 std::string configUpper = cmSystemTools::UpperCase(config);
325 if (!type.empty() && !configUpper.empty()) {
326 // <ARCHIVE|LIBRARY|RUNTIME>_OUTPUT_NAME_<CONFIG>
327 props.push_back(cmStrCat(type, "_OUTPUT_NAME_", configUpper));
328 }
329 if (!type.empty()) {
330 // <ARCHIVE|LIBRARY|RUNTIME>_OUTPUT_NAME
331 props.push_back(type + "_OUTPUT_NAME");
332 }
333 if (!configUpper.empty()) {
334 // OUTPUT_NAME_<CONFIG>
335 props.push_back("OUTPUT_NAME_" + configUpper);
336 // <CONFIG>_OUTPUT_NAME
337 props.push_back(configUpper + "_OUTPUT_NAME");
338 }
339 // OUTPUT_NAME
340 props.emplace_back("OUTPUT_NAME");
341
342 std::string outName;
343 for (std::string const& p : props) {
344 if (cmValue outNameProp = this->GetProperty(p)) {
345 outName = *outNameProp;
346 break;
347 }
348 }
349
350 if (outName.empty()) {
351 outName = this->GetName();
352 }
353
354 // Now evaluate genex and update the previously-prepared map entry.
355 i->second =
356 cmGeneratorExpression::Evaluate(outName, this->LocalGenerator, config);
357 } else if (i->second.empty()) {
358 // An empty map entry indicates we have been called recursively
359 // from the above block.
360 this->LocalGenerator->GetCMakeInstance()->IssueMessage(
361 MessageType::FATAL_ERROR,
362 cmStrCat("Target '", this->GetName(),
363 "' OUTPUT_NAME depends on itself."),
364 this->GetBacktrace());
365 }
366 return i->second;
367}

Callers 10

GetCFBundleDirectoryMethod · 0.95
GetFrameworkDirectoryMethod · 0.95
GetPDBOutputNameMethod · 0.95
GetMethod · 0.80
GetMethod · 0.80
GetMethod · 0.80
GetMethod · 0.80
GetMethod · 0.80
GetAssemblyNameMethod · 0.80

Calls 13

GetOutputTargetTypeMethod · 0.95
GetPropertyMethod · 0.95
GetBacktraceMethod · 0.95
push_backMethod · 0.80
emplace_backMethod · 0.80
cmStrCatFunction · 0.70
findMethod · 0.45
endMethod · 0.45
insertMethod · 0.45
emptyMethod · 0.45
GetNameMethod · 0.45
IssueMessageMethod · 0.45

Tested by

no test coverage detected