summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalXCodeGenerator.cxx
diff options
context:
space:
mode:
authorGregor Jasny <gjasny@googlemail.com>2015-04-07 17:14:52 (GMT)
committerGregor Jasny <gjasny@googlemail.com>2015-04-17 19:49:05 (GMT)
commit7b68c8df6b78951e6d04eea62c3d5cc056796993 (patch)
tree2d56f09b427179e49f495c802f6ad005f265fb15 /Source/cmGlobalXCodeGenerator.cxx
parent48040c19d5f1bcec55a130fcf8f8d83db27291b4 (diff)
downloadCMake-7b68c8df6b78951e6d04eea62c3d5cc056796993.zip
CMake-7b68c8df6b78951e6d04eea62c3d5cc056796993.tar.gz
CMake-7b68c8df6b78951e6d04eea62c3d5cc056796993.tar.bz2
Xcode: Sort Xcode objects by Id
this patch series aims to minimize deltas between the CMake Xcode generator and Xcode itself. It was started by the observation that if one makes any change to the project within Xcode (e.g. to see how a variable is called internally) the user cannot diff the CMake project and the one stored by Xcode afterwards. Xcode keeps the objects ordered by the object id. Because cmake stores them into an unordered container at creation time they must be sorted before writing the pbxproj file. I tested this series with Xcode 6.3 and Xcode 3.2. Both show a reduced diff after this series was applied.
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 0561a05..be40c66 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -592,6 +592,20 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(
}
//----------------------------------------------------------------------------
+
+static bool objectIdLessThan(cmXCodeObject* l, cmXCodeObject* r)
+{
+ return l->GetId() < r->GetId();
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalXCodeGenerator::SortXCodeObjects()
+{
+ std::sort(this->XCodeObjects.begin(), this->XCodeObjects.end(),
+ objectIdLessThan);
+}
+
+//----------------------------------------------------------------------------
void cmGlobalXCodeGenerator::ClearXCodeObjects()
{
this->TargetDoneSet.clear();
@@ -3713,6 +3727,8 @@ cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout,
cmLocalGenerator* ,
std::vector<cmLocalGenerator*>& )
{
+ SortXCodeObjects();
+
fout << "// !$*UTF8*$!\n";
fout << "{\n";
cmXCodeObject::Indent(1, fout);