Xcode: POST_BUILD runs before signing, breaks builds on ARM Mac
With the Xcode generator on macOS arm64, the pattern
add_executable(myexe myexe.c)
add_custom_command(TARGET myexe POST_BUILD COMMAND myexe)
fails to build. The POST_BUILD
command generates a "Run Script" build phase with a script that runs myexe
, but Xcode's build system tries to run that phase before singing the executable.
The build fails with output:
Killed: 9 "/path/to/myexe"
Command PhaseScriptExecution failed with a nonzero exit code