-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Minimal CMake
By :
To try and keep things simple, in Minimal CMake, we opted to limit the number of CMakeLists.txt files in the project to keep things mostly in one place (we at most have two CMakeLists.txt files per project, one for the third-party dependencies and one for the main application itself). This has some advantages; keeping things centralized can make things easier to find and make understanding a project easier, but as a project grows, dealing with a single, enormous file can become a maintenance nightmare (especially with larger teams).
To help improve the separation of concerns and make things more modular, it’s possible to add CMakeLists.txt files to separate directories to handle building separate parts of the application and then bring them into the main build using add_subdirectory. For example, we could move our testing and packaging logic to their respective folders, and then include them from the top-level CMakeLists.txt file in the following way...