diff options
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 381c1f5..41961ed 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -753,7 +753,8 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg, //---------------------------------------------------------------------------- std::string GetSourcecodeValueFromFileExtension(const std::string& _ext, - const std::string& lang) + const std::string& lang, + bool& keepLastKnownFileType) { std::string ext = cmSystemTools::LowerCase(_ext); std::string sourcecode = "sourcecode"; @@ -764,10 +765,12 @@ GetSourcecodeValueFromFileExtension(const std::string& _ext, } else if(ext == "xib") { + keepLastKnownFileType = true; sourcecode = "file.xib"; } else if(ext == "storyboard") { + keepLastKnownFileType = true; sourcecode = "file.storyboard"; } else if(ext == "mm") @@ -778,10 +781,6 @@ GetSourcecodeValueFromFileExtension(const std::string& _ext, { sourcecode += ".c.objc"; } - else if(ext == "xib") - { - sourcecode += ".file.xib"; - } else if(ext == "plist") { sourcecode += ".text.plist"; @@ -797,6 +796,7 @@ GetSourcecodeValueFromFileExtension(const std::string& _ext, } else if(ext == "png" || ext == "gif" || ext == "jpg") { + keepLastKnownFileType = true; sourcecode = "image"; } else if(ext == "txt") @@ -875,8 +875,13 @@ cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath( } else { - std::string sourcecode = GetSourcecodeValueFromFileExtension(ext, lang); - fileRef->AddAttribute("explicitFileType", + bool keepLastKnownFileType = false; + std::string sourcecode = GetSourcecodeValueFromFileExtension(ext, + lang, keepLastKnownFileType); + const char* attribute = keepLastKnownFileType ? + "lastKnownFileType" : + "explicitFileType"; + fileRef->AddAttribute(attribute, this->CreateString(sourcecode.c_str())); } @@ -988,7 +993,8 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, } // organize the sources - std::vector<cmSourceFile*> classes = cmtarget.GetSourceFiles(); + std::vector<cmSourceFile*> classes; + cmtarget.GetSourceFiles(classes); std::sort(classes.begin(), classes.end(), cmSourceFilePathCompare()); std::vector<cmXCodeObject*> externalObjFiles; @@ -1357,7 +1363,8 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases, postbuild.push_back(command); } - std::vector<cmSourceFile*>const &classes = cmtarget.GetSourceFiles(); + std::vector<cmSourceFile*> classes; + cmtarget.GetSourceFiles(classes); // add all the sources std::vector<cmCustomCommand> commands; for(std::vector<cmSourceFile*>::const_iterator i = classes.begin(); @@ -2439,7 +2446,8 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget) // Add source files without build rules for editing convenience. if(cmtarget.GetType() == cmTarget::UTILITY) { - std::vector<cmSourceFile*> const& sources = cmtarget.GetSourceFiles(); + std::vector<cmSourceFile*> sources; + cmtarget.GetSourceFiles(sources); for(std::vector<cmSourceFile*>::const_iterator i = sources.begin(); i != sources.end(); ++i) { @@ -2942,7 +2950,8 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root, cmtarget.AddSourceFile(sf); } - std::vector<cmSourceFile*> classes = cmtarget.GetSourceFiles(); + std::vector<cmSourceFile*> classes; + cmtarget.GetSourceFiles(classes); // Put cmSourceFile instances in proper groups: for(std::vector<cmSourceFile*>::const_iterator s = classes.begin(); @@ -3922,9 +3931,11 @@ cmGlobalXCodeGenerator // to avoid exact duplicate file names. Note that Mac file names are not // typically case sensitive, hence the LowerCase. std::map<cmStdString, int> counts; + std::vector<cmSourceFile*> objectSources; + gt->GetObjectSources(objectSources); for(std::vector<cmSourceFile*>::const_iterator - si = gt->ObjectSources.begin(); - si != gt->ObjectSources.end(); ++si) + si = objectSources.begin(); + si != objectSources.end(); ++si) { cmSourceFile* sf = *si; std::string objectName = @@ -3938,7 +3949,7 @@ cmGlobalXCodeGenerator // TODO: emit warning about duplicate name? } - gt->Objects[sf] = objectName; + gt->AddObject(sf, objectName); } const char* configName = this->GetCMakeCFGIntDir(); |