ソースを参照

Xcode: Don't emit empty settings blocks.

James Touton 9 年 前
コミット
ef494edf76
1 ファイル変更7 行追加6 行削除
  1. 7 6
      Source/cmGlobalXCodeGenerator.cxx

+ 7 - 6
Source/cmGlobalXCodeGenerator.cxx

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