diff options
author | Matt Stevens <matt@alloysoft.com> | 2017-04-29 17:37:32 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-05-03 15:05:42 (GMT) |
commit | 01cd88c0e5e3388c2abf67e259c81e1e6fdc5db2 (patch) | |
tree | 135f1bd2894f9e3016c01c133acb0a12c94b779b | |
parent | e3858dd50b521d1abf466ac5bc55e70a3fdcc5db (diff) | |
download | CMake-01cd88c0e5e3388c2abf67e259c81e1e6fdc5db2.zip CMake-01cd88c0e5e3388c2abf67e259c81e1e6fdc5db2.tar.gz CMake-01cd88c0e5e3388c2abf67e259c81e1e6fdc5db2.tar.bz2 |
Xcode: Remove the top-level Sources and Resources groups
This addresses duplicate file reference warnings from xcodebuild caused
by the same file reference being a member of both the target's group and
the top-level Resources group. Since resources are already a member of
their associated target's group the top-level Resources group isn't
strictly necessary, and removing it results in a project structure
closer to that of a current Xcode project template.
Fixes: #15272
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 36 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.h | 2 |
2 files changed, 1 insertions, 37 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index d99e3bb..5b83131 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -142,8 +142,6 @@ cmGlobalXCodeGenerator::cmGlobalXCodeGenerator( this->RootObject = 0; this->MainGroupChildren = 0; - this->SourcesGroupChildren = 0; - this->ResourcesGroupChildren = 0; this->CurrentMakefile = 0; this->CurrentLocalGenerator = 0; this->XcodeBuildCommandInitialized = false; @@ -701,18 +699,13 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile( cmXCodeObject* buildFile = this->CreateXCodeSourceFileFromPath(sf->GetFullPath(), gtgt, lang, sf); - cmXCodeObject* fileRef = buildFile->GetObject("fileRef")->GetObject(); cmXCodeObject* settings = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); settings->AddAttributeIfNotEmpty("COMPILER_FLAGS", this->CreateString(flags)); - // Is this a resource file in this target? Add it to the resources group... - // - cmGeneratorTarget::SourceFileFlags tsFlags = gtgt->GetTargetSourceFileFlags(sf); - bool isResource = tsFlags.Type == cmGeneratorTarget::SourceFileTypeResource; cmXCodeObject* attrs = this->CreateObject(cmXCodeObject::OBJECT_LIST); @@ -722,10 +715,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile( if (gtgt->IsFrameworkOnApple()) { if (tsFlags.Type == cmGeneratorTarget::SourceFileTypePrivateHeader) { attrs->AddObject(this->CreateString("Private")); - isResource = true; } else if (tsFlags.Type == cmGeneratorTarget::SourceFileTypePublicHeader) { attrs->AddObject(this->CreateString("Public")); - isResource = true; } } @@ -745,14 +736,6 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile( settings->AddAttributeIfNotEmpty("ATTRIBUTES", attrs); - // Add the fileRef to the top level Resources group/folder if it is not - // already there. - // - if (isResource && this->ResourcesGroupChildren && - !this->ResourcesGroupChildren->HasObject(fileRef)) { - this->ResourcesGroupChildren->AddObject(fileRef); - } - buildFile->AddAttributeIfNotEmpty("settings", settings); return buildFile; } @@ -2816,7 +2799,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateOrGetPBXGroup( tgroup = this->CreatePBXGroup(tgroup, tgt_folders[i]); this->TargetGroup[curr_tgt_folder] = tgroup; if (i == 0) { - this->SourcesGroupChildren->AddObject(tgroup); + this->MainGroupChildren->AddObject(tgroup); } } } @@ -2862,8 +2845,6 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( { this->ClearXCodeObjects(); this->RootObject = 0; - this->SourcesGroupChildren = 0; - this->ResourcesGroupChildren = 0; this->MainGroupChildren = 0; cmXCodeObject* group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); group->AddAttribute("COPY_PHASE_STRIP", this->CreateString("NO")); @@ -2885,21 +2866,6 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( mainGroup->AddAttribute("children", this->MainGroupChildren); mainGroup->AddAttribute("sourceTree", this->CreateString("<group>")); - cmXCodeObject* sourcesGroup = this->CreateObject(cmXCodeObject::PBXGroup); - this->SourcesGroupChildren = this->CreateObject(cmXCodeObject::OBJECT_LIST); - sourcesGroup->AddAttribute("name", this->CreateString("Sources")); - sourcesGroup->AddAttribute("children", this->SourcesGroupChildren); - sourcesGroup->AddAttribute("sourceTree", this->CreateString("<group>")); - this->MainGroupChildren->AddObject(sourcesGroup); - - cmXCodeObject* resourcesGroup = this->CreateObject(cmXCodeObject::PBXGroup); - this->ResourcesGroupChildren = - this->CreateObject(cmXCodeObject::OBJECT_LIST); - resourcesGroup->AddAttribute("name", this->CreateString("Resources")); - resourcesGroup->AddAttribute("children", this->ResourcesGroupChildren); - resourcesGroup->AddAttribute("sourceTree", this->CreateString("<group>")); - this->MainGroupChildren->AddObject(resourcesGroup); - // now create the cmake groups if (!this->CreateGroups(generators)) { return false; diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index ee06074..2e1abb5 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -251,8 +251,6 @@ private: std::string PostBuildMakeTarget(std::string const& tName, std::string const& configName); cmXCodeObject* MainGroupChildren; - cmXCodeObject* SourcesGroupChildren; - cmXCodeObject* ResourcesGroupChildren; cmMakefile* CurrentMakefile; cmLocalGenerator* CurrentLocalGenerator; std::vector<std::string> CurrentConfigurationTypes; |