Executing Custom Tasks with CMake
Building and shipping software can be a complex task, and no tool can ever do all the different tasks that are needed to build and ship a project. At some point, you may want to execute a task that is not covered by a compiler or CMake’s functionality. Common tasks include archiving build artifacts, creating hashes to verify downloads, or generating or customizing input files for a build. There are also lots of other specialized tasks that depend on the environment that certain software is built in.
In this chapter, we will learn how to include such custom tasks in a CMake project and how to create custom build targets and custom commands. We will go over how to create and manage dependencies between targets and how to include or exclude them from standard builds.
Including such external programs in the build steps of a project can help ensure that code is kept consistent, even when many people contribute to it. As a CMake build is very...