Summary
In this chapter, we covered valuable concepts that lay a strong foundation for building robust and future-proof projects. We discussed setting the minimum CMake version and configuring essential project aspects like name, languages, and metadata fields. Establishing these foundations enables our projects to scale effectively.
We explored project partitioning, comparing the use of basic include()
with add_subdirectory
, which offers benefits such as scoped variable management, simplified paths, and increased modularity. The ability to create nested projects and build them separately proved useful in gradually breaking down code into more independent units.
After understanding the available partitioning mechanisms, we delved into creating transparent, resilient, and extensible project structures. We examined CMake's traversal of listfiles and the correct order of configuration steps.
Next, we studied how we can scope the environment of our target and host machines, what the...