Separate debug information
If I build an application with RelWithDebInfo
build type I will get a release with debug information build.
Now if I want to distribute the application I don't want to ship the debug information, since it tends to be big. But make it available in the situation that my application crashes so that the call stack makes sense.
CMake offers in CPackDeb.cmake
the ability to have files generated by objcopy --only-keep-debug
calls.
Unfortunately there is nothing about dsymutil
for macOS.
Users have done the following for macOS:
find_program(DSYMUTIL_PROGRAM dsymutil)
if (DSYMUTIL_PROGRAM)
foreach(lang C CXX)
foreach(var LINK_EXECUTABLE CREATE_SHARED_LIBRARY)
set(CMAKE_${lang}_${var} "${CMAKE_${lang}_${var}}" "${DSYMUTIL_PROGRAM} <TARGET>")
endforeach()
endforeach()
endif()
I was thinking at having a per target property SEPARATE_DEBUG_INFO
initialized by CMAKE_SEPARATE_DEBUG_INFO
which would call objcopy --only-keep-debug
for GNU, dsymutil
for macOS/Clang.
Then when the user issues an install(TARGET)
add the above generated debug file to a component named DebugInfo
.
Then when the user does a cmake --install . --component DebugInfo
the debug files will be installed. This would include the MSVC's PDB files.
Then one just has to pack / archive the directory and it's not specific only to a CPack format.