Arno Duvenhage
Arno Duvenhage

Reputation: 1970

cmake -g flag not generating 'DWARF with dSym file' debug information

I'm using cmake to generate a C++ Xcode project, but the debug information never gets generated. I have to manually select 'DWARF with dSym file' from the build setting every time I have generated the project with cmake.

Using 'SET (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")' makes no difference.

I'm also pretty sure it used to work correctly with XCode 6 (now using Xcode 7)

Upvotes: 11

Views: 7098

Answers (1)

user2288008
user2288008

Reputation:

Solution

You can use CMAKE_XCODE_ATTRIBUTE_* variable.

To set DWARF you can use:

set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf")

To set DWARF with dSYM File:

set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf-with-dsym")

Hints

Name of the Xcode attribute and values can be found in "Quick Help" section (see square brackered [DEBUG_INFORMATION_FORMAT], [dwarf] and [dwarf-with-dsym]):

enter image description here

Upvotes: 18

Related Questions