[Cmake-commits] CMake branch, next, updated. v2.8.5-1832-gb39bee5

David Cole david.cole at kitware.com
Tue Sep 6 15:18:29 EDT 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  b39bee533db5e387d081d93668ef97595c2de497 (commit)
       via  cb22afc02c0524ff2b701b33a29339dde1e80bbd (commit)
      from  59c05d03a49fef910d60870014a69803ae6bb84e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b39bee533db5e387d081d93668ef97595c2de497
commit b39bee533db5e387d081d93668ef97595c2de497
Merge: 59c05d0 cb22afc
Author:     David Cole <david.cole at kitware.com>
AuthorDate: Tue Sep 6 15:18:28 2011 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Sep 6 15:18:28 2011 -0400

    Merge topic 'fix-12377-xcode-honor-g0' into next
    
    cb22afc Xcode: Honor -g0 to disable debugging (#12377)


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cb22afc02c0524ff2b701b33a29339dde1e80bbd
commit cb22afc02c0524ff2b701b33a29339dde1e80bbd
Author:     Johan Bjork <phb at spotify.com>
AuthorDate: Thu Aug 18 19:30:51 2011 +0200
Commit:     David Cole <david.cole at kitware.com>
CommitDate: Tue Sep 6 15:04:58 2011 -0400

    Xcode: Honor -g0 to disable debugging (#12377)
    
    This commit changes ExtractFlag to remove all occurences
    of a flag, and only save the last one. (i.e., the dominant
    one according to GCC rules)

diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 02a95fe..a8a6eb4 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1219,19 +1219,30 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases,
 }
 
 //----------------------------------------------------------------------------
+// This function removes each occurence of the flag and returns the last one
+// (i.e., the dominant flag in GCC)
 std::string cmGlobalXCodeGenerator::ExtractFlag(const char* flag,
                                                 std::string& flags)
 {
   std::string retFlag;
-  std::string::size_type pos = flags.find(flag);
-  if(pos != flags.npos && (pos ==0 || flags[pos-1]==' '))
+  std::string::size_type pos = flags.rfind(flag);
+  bool saved = false;
+  while(pos != flags.npos)
     {
-    while(pos < flags.size() && flags[pos] != ' ')
+    if(pos == 0 || flags[pos-1]==' ')
       {
-      retFlag += flags[pos];
-      flags[pos] = ' ';
-      pos++;
+      while(pos < flags.size() && flags[pos] != ' ')
+        {
+        if(!saved)
+          {
+          retFlag += flags[pos];
+          }
+        flags[pos] = ' ';
+        pos++;
+        }
       }
+      saved = true;
+      pos = flags.rfind(flag);
     }
   return retFlag;
 }
@@ -1870,7 +1881,17 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
     flags += gflag;
     }
   const char* debugStr = "YES";
-  if(gflagc.size() ==0  && gflag.size() == 0)
+  // We can't set the Xcode flag differently depending on the language,
+  // so put them back in this case.
+  if( (lang && strcmp(lang, "CXX") == 0) && gflag != gflagc )
+    {
+    cflags += " ";
+    cflags += gflagc;
+    flags += " ";
+    flags += gflag;
+    debugStr = "NO";
+    }
+  if( gflag == "-g0" || gflag.size() == 0 )
     {
     debugStr = "NO";
     }

-----------------------------------------------------------------------

Summary of changes:
 Source/cmGlobalXCodeGenerator.cxx |   35 ++++++++++++++++++++++++++++-------
 1 files changed, 28 insertions(+), 7 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list