summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorJohan Björk <phb@spotify.com>2011-02-20 13:05:41 (GMT)
committerBrad King <brad.king@kitware.com>2011-06-07 14:44:27 (GMT)
commiteeeeca1082a8be5890a6d2096b505ebe584fc2b7 (patch)
tree47b5923814f67241953177092ce258e6f5c356ab /Source
parent59ed84e032922f4d44b973837aa24497d182d2d3 (diff)
downloadCMake-eeeeca1082a8be5890a6d2096b505ebe584fc2b7.zip
CMake-eeeeca1082a8be5890a6d2096b505ebe584fc2b7.tar.gz
CMake-eeeeca1082a8be5890a6d2096b505ebe584fc2b7.tar.bz2
XCode: Support target folders on XCode.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx50
1 files changed, 39 insertions, 11 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index e7ae8be..688296e 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2481,27 +2481,55 @@ cmXCodeObject *cmGlobalXCodeGenerator
cmXCodeObject* cmGlobalXCodeGenerator
::CreateOrGetPBXGroup(cmTarget& cmtarget, cmSourceGroup* sg)
{
- cmStdString s = cmtarget.GetName();
- s += "/";
+ cmStdString s;
+ cmStdString target;
+ const char *targetFolder= cmtarget.GetProperty("FOLDER");
+ if(targetFolder) {
+ target = targetFolder;
+ target += "/";
+ }
+ target += cmtarget.GetName();
+ s = target + "/";
s += sg->GetFullName();
- std::map<cmStdString, cmXCodeObject* >::iterator i =
+ std::map<cmStdString, cmXCodeObject* >::iterator it =
this->GroupNameMap.find(s);
- if(i != this->GroupNameMap.end())
+ if(it != this->GroupNameMap.end())
{
- return i->second;
+ return it->second;
}
- i = this->TargetGroup.find(cmtarget.GetName());
+
+ it = this->TargetGroup.find(target);
cmXCodeObject* tgroup = 0;
- if(i != this->TargetGroup.end())
+ if(it != this->TargetGroup.end())
{
- tgroup = i->second;
+ tgroup = it->second;
}
else
{
- tgroup = this->CreatePBXGroup(NULL,cmtarget.GetName());
- this->TargetGroup[cmtarget.GetName()] = tgroup;
- this->SourcesGroupChildren->AddObject(tgroup);
+ std::vector<std::string> tgt_folders = cmSystemTools::tokenize(target, "/");
+ cmStdString curr_tgt_folder;
+ for(std::vector<std::string>::size_type i = 0; i < tgt_folders.size();i++)
+ {
+ curr_tgt_folder += tgt_folders[i];
+ it = this->TargetGroup.find(curr_tgt_folder);
+ if(it == this->TargetGroup.end())
+ {
+ tgroup = this->CreatePBXGroup(tgroup,tgt_folders[i]);
+ this->TargetGroup[curr_tgt_folder] = tgroup;
+ }
+ else
+ {
+ tgroup = it->second;
+ continue;
+ }
+ if(i == 0)
+ {
+ this->SourcesGroupChildren->AddObject(tgroup);
+ }
+ curr_tgt_folder += "/";
+ }
}
+ this->TargetGroup[target] = tgroup;
// If it's the default source group (empty name) then put the source file
// directly in the tgroup...