diff options
author | Brad King <brad.king@kitware.com> | 2017-04-12 18:33:48 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-04-13 20:10:33 (GMT) |
commit | e44a8d2c322ba82c594740a2d2e49f89afdcc244 (patch) | |
tree | cc068d69f06307f48835adf63f894d27a37fb4a2 | |
parent | 97cc29c7662f51f0e532f92e37070f9b44791b88 (diff) | |
download | CMake-e44a8d2c322ba82c594740a2d2e49f89afdcc244.zip CMake-e44a8d2c322ba82c594740a2d2e49f89afdcc244.tar.gz CMake-e44a8d2c322ba82c594740a2d2e49f89afdcc244.tar.bz2 |
Xcode: Refactor loop over all sources
Switch from `GetConfigCommonSourceFiles` to `GetAllConfigSources`.
This will allow us to drop object library files from the former.
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 45 |
1 files changed, 12 insertions, 33 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 57d9156..ecc3e31 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -651,11 +651,6 @@ std::string GetGroupMapKeyFromPath(cmGeneratorTarget* target, return key; } -std::string GetGroupMapKey(cmGeneratorTarget* target, cmSourceFile* sf) -{ - return GetGroupMapKeyFromPath(target, sf->GetFullPath()); -} - cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFileFromPath( const std::string& fullpath, cmGeneratorTarget* target, const std::string& lang, cmSourceFile* sf) @@ -2788,42 +2783,26 @@ bool cmGlobalXCodeGenerator::CreateGroups( gtgt->AddSource(plist); } - std::vector<cmSourceFile*> classes; - if (!gtgt->GetConfigCommonSourceFiles(classes)) { - return false; - } + std::vector<cmGeneratorTarget::AllConfigSource> const& sources = + gtgt->GetAllConfigSources(); + // Put cmSourceFile instances in proper groups: - for (std::vector<cmSourceFile*>::const_iterator s = classes.begin(); - s != classes.end(); s++) { - cmSourceFile* sf = *s; + for (std::vector<cmGeneratorTarget::AllConfigSource>::const_iterator si = + sources.begin(); + si != sources.end(); ++si) { + cmSourceFile const* sf = si->Source; + if (this->XcodeVersion >= 50 && !sf->GetObjectLibrary().empty()) { + // 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.c_str(), sourceGroups); cmXCodeObject* pbxgroup = this->CreateOrGetPBXGroup(gtgt, sourceGroup); - std::string key = GetGroupMapKey(gtgt, sf); + std::string key = GetGroupMapKeyFromPath(gtgt, source); this->GroupMap[key] = pbxgroup; } - - if (this->XcodeVersion < 50) { - // Put OBJECT_LIBRARY objects in proper groups: - std::vector<cmSourceFile const*> objs; - gtgt->GetExternalObjects(objs, ""); - for (std::vector<cmSourceFile const*>::const_iterator oi = - objs.begin(); - oi != objs.end(); ++oi) { - if ((*oi)->GetObjectLibrary().empty()) { - continue; - } - std::string const& source = (*oi)->GetFullPath(); - cmSourceGroup* sourceGroup = - mf->FindSourceGroup(source.c_str(), sourceGroups); - cmXCodeObject* pbxgroup = - this->CreateOrGetPBXGroup(gtgt, sourceGroup); - std::string key = GetGroupMapKeyFromPath(gtgt, source); - this->GroupMap[key] = pbxgroup; - } - } } } return true; |