Building and managing dependencies
All build processes work the same way. We start from the top-level listfile and navigate downward into the project source tree. Figure 12.4 shows which project files partake in building. Numbers in parentheses indicate the order of the CMake script execution:
Our top-level listfile will configure the project and load nested elements:
chapter-12/01-full-project/CMakeLists.txt
cmake_minimum_required(VERSION 3.20.0) project(Calc VERSION 1.0.0 LANGUAGES CXX) list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") include(NoInSourceBuilds) add_subdirectory(src bin) add_subdirectory(test) include(Install)
We start by providing key project details and adding a path to the CMake utility modules (the cmake
directory in our project). We then disable in-source builds (through a custom module) and include two key directories:
src
, containing the project source...