Using external programs with CMake
CMake has a pretty broad functionality so that it can cover many tasks when building software. However, there are situations when developers will need to do something that is not covered. Common examples include running special tools that do some pre-or postprocessing of files for a target, using source code generators that produce input for the compiler, and compressing and archiving artifacts that are not handled with CPack. The list of such special tasks that must be accomplished during a build step is probably almost endless. CMake supports three ways of executing custom tasks:
- By defining a target that executes a command with
- By attaching a custom command to an existing target by using
add_custom_commandor by making a target depend on a file that's been generated by a custom command
- By using the
execute_processfunction, which executes a command during the configuration step
Whenever possible, external...