Executing custom tasks at build time
The most generic way to add a custom task is by creating a custom target that executes an external task as a sequence of commands. Custom targets are handled like any other library or executable target, with the difference that they do not invoke the compiler and linker; instead, they do something defined by the user. Custom targets are defined using the add_custom_target
command:
add_custom_target(Name [ALL] [command1 [args1...]] [COMMAND command2 [args2...] ...] [DEPENDS depend depend depend ... ] [BYPRODUCTS [files...]] ...