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

Method CreateUtilityTarget

Source/cmGlobalXCodeGenerator.cxx:3272–3333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3270}
3271
3272cmXCodeObject* cmGlobalXCodeGenerator::CreateUtilityTarget(
3273 cmGeneratorTarget* gtgt)
3274{
3275 cmXCodeObject* shellBuildPhase = this->CreateObject(
3276 cmXCodeObject::PBXShellScriptBuildPhase, gtgt->GetName());
3277 shellBuildPhase->AddAttribute("buildActionMask",
3278 this->CreateString("2147483647"));
3279 cmXCodeObject* buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
3280 shellBuildPhase->AddAttribute("files", buildFiles);
3281 cmXCodeObject* inputPaths = this->CreateObject(cmXCodeObject::OBJECT_LIST);
3282 shellBuildPhase->AddAttribute("inputPaths", inputPaths);
3283 cmXCodeObject* outputPaths = this->CreateObject(cmXCodeObject::OBJECT_LIST);
3284 shellBuildPhase->AddAttribute("outputPaths", outputPaths);
3285 shellBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
3286 this->CreateString("0"));
3287 shellBuildPhase->AddAttribute("shellPath", this->CreateString("/bin/sh"));
3288 shellBuildPhase->AddAttribute(
3289 "shellScript", this->CreateString("# shell script goes here\nexit 0"));
3290 shellBuildPhase->AddAttribute("showEnvVarsInLog", this->CreateString("0"));
3291
3292 std::string targetBinaryPath = cmStrCat(
3293 gtgt->Makefile->GetCurrentBinaryDirectory(), '/', gtgt->GetName());
3294
3295 cmXCodeObject* target = this->CreateObject(
3296 cmXCodeObject::PBXAggregateTarget,
3297 cmStrCat("PBXAggregateTarget:", gtgt->GetName(), ':', targetBinaryPath));
3298 target->SetComment(gtgt->GetName());
3299 cmXCodeObject* buildPhases = this->CreateObject(cmXCodeObject::OBJECT_LIST);
3300 std::vector<cmXCodeObject*> emptyContentVector;
3301 this->CreateCustomCommands(buildPhases, nullptr, nullptr, nullptr,
3302 emptyContentVector, nullptr, gtgt);
3303 target->AddAttribute("buildPhases", buildPhases);
3304 this->AddConfigurations(target, gtgt);
3305 cmXCodeObject* dependencies = this->CreateObject(cmXCodeObject::OBJECT_LIST);
3306 target->AddAttribute("dependencies", dependencies);
3307 target->AddAttribute("name", this->CreateString(gtgt->GetName()));
3308 target->AddAttribute("productName", this->CreateString(gtgt->GetName()));
3309 target->SetTarget(gtgt);
3310 this->XCodeObjectMap[gtgt] = target;
3311
3312 // Add source files without build rules for editing convenience.
3313 if (gtgt->GetType() != cmStateEnums::GLOBAL_TARGET &&
3314 gtgt->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET) {
3315 std::vector<cmSourceFile*> sources;
3316 if (!gtgt->GetConfigCommonSourceFilesForXcode(sources)) {
3317 return nullptr;
3318 }
3319
3320 // Add CMakeLists.txt file for user convenience.
3321 this->AddXCodeProjBuildRule(gtgt, sources);
3322
3323 for (auto* sourceFile : sources) {
3324 if (!sourceFile->GetIsGenerated()) {
3325 this->CreateXCodeFileReference(sourceFile, gtgt);
3326 }
3327 }
3328 }
3329

Callers 1

CreateXCodeTargetMethod · 0.95

Calls 15

CreateObjectMethod · 0.95
CreateStringMethod · 0.95
CreateCustomCommandsMethod · 0.95
AddConfigurationsMethod · 0.95
AddXCodeProjBuildRuleMethod · 0.95
GetOrCreateIdMethod · 0.95
GetIsGeneratedMethod · 0.80
cmStrCatFunction · 0.70
GetNameMethod · 0.45
AddAttributeMethod · 0.45

Tested by

no test coverage detected