Specifically I want to run a command before and after compilation. I managed to do that with a custom target my project depends on and a add_custom_command(TARGET project POST_BUILD ...)
for the second call. However if there is nothing to build, that POST_BUILD command isn't triggered - which is something I need to catch. Any way to do that?