diff options
author | Brad King <brad.king@kitware.com> | 2019-04-10 11:59:37 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-04-11 14:35:14 (GMT) |
commit | b4385d5ccc0241f8adcb012ad645d3696bcc544c (patch) | |
tree | b893968481f32c97e53f9744543445e8da7bc07f /Source/cmGlobalXCodeGenerator.cxx | |
parent | 3c9dec0bdc11a69afcbaa93a0e61dc71cddd5491 (diff) | |
download | CMake-b4385d5ccc0241f8adcb012ad645d3696bcc544c.zip CMake-b4385d5ccc0241f8adcb012ad645d3696bcc544c.tar.gz CMake-b4385d5ccc0241f8adcb012ad645d3696bcc544c.tar.bz2 |
Xcode: Factor out duplicate source group code into lambda
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 51c001e..dd6008f 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2875,6 +2875,14 @@ bool cmGlobalXCodeGenerator::CreateGroups( continue; } + auto addSourceToGroup = [this, mf, gtgt, + &sourceGroups](std::string const& source) { + cmSourceGroup* sourceGroup = mf->FindSourceGroup(source, sourceGroups); + cmXCodeObject* pbxgroup = this->CreateOrGetPBXGroup(gtgt, sourceGroup); + std::string key = GetGroupMapKeyFromPath(gtgt, source); + this->GroupMap[key] = pbxgroup; + }; + // add the soon to be generated Info.plist file as a source for a // MACOSX_BUNDLE file if (gtgt->GetPropertyAsBool("MACOSX_BUNDLE")) { @@ -2890,12 +2898,7 @@ bool cmGlobalXCodeGenerator::CreateGroups( // Object library files go on the link line instead. continue; } - // Add the file to the list of sources. - std::string const& source = sf->GetFullPath(); - cmSourceGroup* sourceGroup = mf->FindSourceGroup(source, sourceGroups); - cmXCodeObject* pbxgroup = this->CreateOrGetPBXGroup(gtgt, sourceGroup); - std::string key = GetGroupMapKeyFromPath(gtgt, source); - this->GroupMap[key] = pbxgroup; + addSourceToGroup(sf->GetFullPath()); } // Add CMakeLists.txt file for user convenience. @@ -2904,11 +2907,7 @@ bool cmGlobalXCodeGenerator::CreateGroups( gtgt->GetLocalGenerator()->GetCurrentSourceDirectory(); listfile += "/CMakeLists.txt"; cmSourceFile* sf = gtgt->Makefile->GetOrCreateSource(listfile); - std::string const& source = sf->GetFullPath(); - cmSourceGroup* sourceGroup = mf->FindSourceGroup(source, sourceGroups); - cmXCodeObject* pbxgroup = this->CreateOrGetPBXGroup(gtgt, sourceGroup); - std::string key = GetGroupMapKeyFromPath(gtgt, source); - this->GroupMap[key] = pbxgroup; + addSourceToGroup(sf->GetFullPath()); } } } |