In this chapter, you learned how to customize a build by executing external tasks and programs. We covered how to add custom build actions as targets, how to add them to existing targets, and how to execute them during the configuration step. We went over how commands can generate files and how CMake can copy and modify files with the
configure_file command. Finally, we learned how the CMake command-line utility can be used to perform tasks in a platform-independent manner.
The ability to customize a CMake build is a very powerful tool but it also tends to make builds more brittle as the complexity of the builds often increases when any customized tasks are performed. Although sometimes not avoidable, relying on external programs other than a compiler and linker being installed may mean that a piece of software can be built on a platform where those programs haven't been installed or aren't available. This means special care must be taken to ensure that custom...