Xcode: Don't emit empty settings blocks.

This commit is contained in:
James Touton 2016-06-03 18:32:38 -07:00 committed by Brad King
parent 82ebbf683e
commit ef494edf76
1 changed files with 7 additions and 6 deletions

View File

@ -689,7 +689,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
cmXCodeObject* fileRef = buildFile->GetObject("fileRef")->GetObject(); cmXCodeObject* fileRef = buildFile->GetObject("fileRef")->GetObject();
cmXCodeObject* settings = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); cmXCodeObject* settings = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
settings->AddAttribute("COMPILER_FLAGS", this->CreateString(flags)); settings->AddAttributeIfNotEmpty("COMPILER_FLAGS",
this->CreateString(flags));
// Is this a resource file in this target? Add it to the resources group... // Is this a resource file in this target? Add it to the resources group...
// //
@ -698,23 +699,23 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
gtgt->GetTargetSourceFileFlags(sf); gtgt->GetTargetSourceFileFlags(sf);
bool isResource = tsFlags.Type == cmGeneratorTarget::SourceFileTypeResource; bool isResource = tsFlags.Type == cmGeneratorTarget::SourceFileTypeResource;
cmXCodeObject* attrs = this->CreateObject(cmXCodeObject::OBJECT_LIST);
// Is this a "private" or "public" framework header file? // Is this a "private" or "public" framework header file?
// Set the ATTRIBUTES attribute appropriately... // Set the ATTRIBUTES attribute appropriately...
// //
if (gtgt->IsFrameworkOnApple()) { if (gtgt->IsFrameworkOnApple()) {
if (tsFlags.Type == cmGeneratorTarget::SourceFileTypePrivateHeader) { if (tsFlags.Type == cmGeneratorTarget::SourceFileTypePrivateHeader) {
cmXCodeObject* attrs = this->CreateObject(cmXCodeObject::OBJECT_LIST);
attrs->AddObject(this->CreateString("Private")); attrs->AddObject(this->CreateString("Private"));
settings->AddAttribute("ATTRIBUTES", attrs);
isResource = true; isResource = true;
} else if (tsFlags.Type == cmGeneratorTarget::SourceFileTypePublicHeader) { } else if (tsFlags.Type == cmGeneratorTarget::SourceFileTypePublicHeader) {
cmXCodeObject* attrs = this->CreateObject(cmXCodeObject::OBJECT_LIST);
attrs->AddObject(this->CreateString("Public")); attrs->AddObject(this->CreateString("Public"));
settings->AddAttribute("ATTRIBUTES", attrs);
isResource = true; isResource = true;
} }
} }
settings->AddAttributeIfNotEmpty("ATTRIBUTES", attrs);
// Add the fileRef to the top level Resources group/folder if it is not // Add the fileRef to the top level Resources group/folder if it is not
// already there. // already there.
// //
@ -723,7 +724,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
this->ResourcesGroupChildren->AddObject(fileRef); this->ResourcesGroupChildren->AddObject(fileRef);
} }
buildFile->AddAttribute("settings", settings); buildFile->AddAttributeIfNotEmpty("settings", settings);
return buildFile; return buildFile;
} }