MantisBT - CMake
View Issue Details
0012377CMakeCMakepublic2011-08-01 10:172012-12-20 11:36
Johan Björk 
David Cole 
normalmajoralways
closedfixed 
Apple MacOS X10.4.10
CMake 2.8.5 
CMake 2.8.6CMake 2.8.6 
0012377: CMake misparses -g0 as enable debug
cmGlobalXCodeGenerator.cpp missparses -g0 (disable debug) as ENABLE, see following code:

  std::string gflagc = this->ExtractFlag("-g", cflags);
  // put back gdwarf-2 if used since there is no way
  // to represent it in the gui, but we still want debug yes
  if(gflagc == "-gdwarf-2")
    {
    cflags += " ";
    cflags += gflagc;
    }
  std::string gflag = this->ExtractFlag("-g", flags);
  if(gflag == "-gdwarf-2")
    {
    flags += " ";
    flags += gflag;
    }
  const char* debugStr = "YES";
  if(gflagc.size() ==0 && gflag.size() == 0)
    {
    debugStr = "NO";
    }
Set -g0 in CXX or C flags.
No tags attached.
related to 0013354closed Robert Maynard CMake hangs generating XCode project file when CXXFLAGS contains -g in a flag 
patch 0001-xcode-Honor-g0-to-disable-debugging.patch (2,353) 2011-08-18 13:35
https://public.kitware.com/Bug/file/4011/0001-xcode-Honor-g0-to-disable-debugging.patch
Issue History
2011-08-01 10:17Johan BjörkNew Issue
2011-08-02 10:53Sean McBrideNote Added: 0027149
2011-08-18 13:35Johan BjörkFile Added: 0001-xcode-Honor-g0-to-disable-debugging.patch
2011-08-18 13:35Johan BjörkNote Added: 0027240
2011-08-31 11:08David ColeAssigned To => David Cole
2011-08-31 11:08David ColeStatusnew => assigned
2011-08-31 11:08David ColeTarget Version => CMake 2.8.6
2011-09-06 15:33David ColeNote Added: 0027384
2011-09-06 15:33David ColeStatusassigned => resolved
2011-09-06 15:33David ColeFixed in Version => CMake 2.8.6
2011-09-06 15:33David ColeResolutionopen => fixed
2012-02-06 06:07David ColeNote Added: 0028494
2012-02-06 06:07David ColeStatusresolved => closed
2012-12-20 11:36David ColeRelationship addedrelated to 0013354

Notes
(0027149)
Sean McBride   
2011-08-02 10:53   
The gcc man page indeed says:

"-glevel Request debugging information and also use level to specify how much information. The default level is 2.
Level 0 produces no debug information at all. Thus, -g0 negates -g."
(0027240)
Johan Björk   
2011-08-18 13:35   
Implementing this is a bit trickier then just changing the flag, as we need to honor ordering.
Attached patch fixes the issue.
(0027384)
David Cole   
2011-09-06 15:33   
Fix pushed to 'next' with this commit:

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cb22afc02c0524ff2b701b33a29339dde1e80bbd [^]
(0028494)
David Cole   
2012-02-06 06:07   
Closing resolved issues that have not been updated in more than 4 months.