I am using a custom_command as a POST_BUILD step for signing executables. This command depends on a target to create the certificate used for signing. The executable targets also depend (with add_dependency) on this certificate creation target. When someone accidentally deletes the certificate, the build will create a new certificate, but not trigger a rebuild for all the executables, because their dependencies have not changed. But the POST_BUILD custom command is not executed either, so the certificate and the already signed executables do not match anymore. How do I get the executables to rebuild/link or just the post build step to execute after a change of the certificate file?
Based on Tsyvarev's suggestion I tried the LINK_DEPENDS and since I only use ninja, it works for me:
set_target_properties(${target} PROPERTIES LINK_DEPENDS ${CERTIFICATE_FILE})
where ${target} is every executable I need to sign