I have a simple C++ application built using CMake. In macOS it can be allowed to dump core on crash by doing something like:
add_custom_command(TARGET mytarget POST_BUILD
COMMAND /usr/libexec/PlistBuddy -c "Add :com.apple.security.get-task-allow bool true" coredump.entitlements
COMMAND codesign -s - -f --entitlements coredump.entitlements $<TARGET_FILE:mytarget>
COMMAND rm -f coredump.entitlements
VERBATIM)
This works for the built program (e.g. running as ./build/bin/mytarget) but after make install the installed program fails to start, error: Killed: 9
How can I perform the codesign step again after CMake install, or make the initial signing persistent through a make install?
Thanks to @Osyotr for pointing me in the right direction. I ended up with the following: