The code for this recipe is available at https://github.com/dev-cafe/cmake-cookbook/tree/v1.0/chapter-10/recipe-01 and has a C++ example. The recipe is valid with CMake version 3.6 (and higher) and has been tested on GNU/Linux, macOS, and Windows.
In this very first recipe, we will introduce our small project and some of the basic concepts that will be used also in the subsequent recipes. Installing files, libraries, and executables is a very basic task, but it can present some pitfalls. We will walk you through these and show you how to effectively avoid many of them with CMake.