4 ms·
I like to have a meta project with the root CMakeLists.txt. In this meta project I either just add_subdirectory all necessary components manually, or I use Fin
by xaedes 6y ago
I like to have a meta project with the root CMakeLists.txt.
In this meta project I either just add_subdirectory all necessary components manually, or I use Findxyz.cmake scripts for each module with that "header guard". They check if target is already defined, if not they add_subdirectory the required component.
For each component (i.e. cmake project) I can then just find_package (module mode) all dependencies and target_link them. Like any other dependency.
For consistency reasons I like to put cmake find modules for all external (installed) library as well and then let the find modules use find_package in config mode for installed libraries, and add_subdirectory for my own components, or for projects I want to include with source and build along with the other stuff.
This way I have one point where I can control the source of all dependencies.
Another way would be to just install all components as libraries in the system with proper cmake config files for find_package in config mode.
I dont like to clutter my system with all kinds of application specific libraries, so that is not the way for me.