I am trying to generate a dSYM file for my Release configuration. In my CMake config, I have:
if (CMAKE_GENERATOR STREQUAL "Xcode")
# generate debug symbols in a .dsym file for release mode
set(CMAKE_XCODE_ATTRIBUTE_GCC_GENERATE_DEBUGGING_SYMBOLS[variant=Release]
"YES")
set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT[variant=Release]
"dwarf-with-dsym")
# strip symbols from final executable
set(CMAKE_XCODE_ATTRIBUTE_DEPLOYMENT_POSTPROCESSING[variant=Release]
"YES")
endif()
The debug information format and deployment postprocessing are both picked up for the Release configuration. However, Generate Debug Symbols
in the XCode interface / GCC_GENERATE_DEBUGGING_SYMBOLS
in the xxx.xcodeproj/project.pbxproj
file are set toNO
for the Release configuration.
Removing the [variant=Release]
restriction has no effect on the Release config. If I manually turn on the setting in Release, I am getting the desired outcome. How can I get CMake to create the Xcode project with this setting on for the Release config?
I do not want to use RelWithDebInfo
because it has a lower optimization setting (-O2
instead of -O3
). I want the .dSYM
file for debugging crashes from the field.
add_compile_options
with appropriate generator expressions. – Hui