CMake's add_custom_command()
allows one to run a command (through the COMMAND
option) before or after building the target (using PRE_BUILD
, PRE_LINK
and POST_BUILD
). The command can be an executable or external "script", but not a CMake macro/function.
Is there a similar command like add_custom_command()
, which instead allows passing of a CMake function/macro and schedule it before/after a target was built?
If not, what options are there, besides implementing the COMMAND
as a re-run of CMake with a flag that enables the functionality inside the function/macro?
[EDIT] The function/macro will take as input the CMake target name and a target specific directory path.