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

Method CreateXCodeTarget

Source/cmGlobalXCodeGenerator.cxx:1518–1790  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1516}
1517
1518bool cmGlobalXCodeGenerator::CreateXCodeTarget(
1519 cmGeneratorTarget* gtgt, std::vector<cmXCodeObject*>& targets)
1520{
1521 std::string targetName = gtgt->GetName();
1522
1523 // make sure ALL_BUILD, INSTALL, etc are only done once
1524 if (this->SpecialTargetEmitted(targetName)) {
1525 return true;
1526 }
1527
1528 if (!gtgt->IsInBuildSystem()) {
1529 return true;
1530 }
1531
1532 for (std::string const& configName : this->CurrentConfigurationTypes) {
1533 gtgt->CheckCxxModuleStatus(configName);
1534 }
1535
1536 auto& gtgt_visited = this->CommandsVisited[gtgt];
1537 auto const& deps = this->GetTargetDirectDepends(gtgt);
1538 for (auto const& d : deps) {
1539 // Take the union of visited source files of custom commands so far.
1540 // ComputeTargetOrder ensures our dependencies already visited their
1541 // custom commands and updated CommandsVisited.
1542 auto& dep_visited = this->CommandsVisited[d];
1543 gtgt_visited.insert(dep_visited.begin(), dep_visited.end());
1544 }
1545
1546 if (gtgt->GetType() == cmStateEnums::UTILITY ||
1547 gtgt->GetType() == cmStateEnums::INTERFACE_LIBRARY ||
1548 gtgt->GetType() == cmStateEnums::GLOBAL_TARGET) {
1549 cmXCodeObject* t = this->CreateUtilityTarget(gtgt);
1550 if (!t) {
1551 return false;
1552 }
1553 targets.push_back(t);
1554 return true;
1555 }
1556
1557 // organize the sources
1558 std::vector<cmSourceFile*> commonSourceFiles;
1559 if (!gtgt->GetConfigCommonSourceFilesForXcode(commonSourceFiles)) {
1560 return false;
1561 }
1562
1563 // Add CMakeLists.txt file for user convenience.
1564 this->AddXCodeProjBuildRule(gtgt, commonSourceFiles);
1565
1566 // Add the Info.plist we are about to generate for an App Bundle.
1567 if (gtgt->GetPropertyAsBool("MACOSX_BUNDLE")) {
1568 std::string plist = this->ComputeInfoPListLocation(gtgt);
1569 cmSourceFile* sf = gtgt->Makefile->GetOrCreateSource(
1570 plist, true, cmSourceFileLocationKind::Known);
1571 sf->SetSpecialSourceType(cmSourceFile::SpecialSourceType::BundleInfoPlist);
1572 commonSourceFiles.push_back(sf);
1573 }
1574
1575 std::sort(commonSourceFiles.begin(), commonSourceFiles.end(),

Callers 1

CreateXCodeTargetsMethod · 0.95

Calls 15

SpecialTargetEmittedMethod · 0.95
CreateUtilityTargetMethod · 0.95
AddXCodeProjBuildRuleMethod · 0.95
CreateXCodeSourceFileMethod · 0.95
IsHeaderFileMethod · 0.95
CreateObjectMethod · 0.95
CreateStringMethod · 0.95
CreateCustomCommandsMethod · 0.95
RelativeToRootBinaryMethod · 0.95
AddConfigurationsMethod · 0.95
GetTargetFileTypeMethod · 0.95

Tested by

no test coverage detected