Hi,
I just wanted to know if it is considered good practice if a CMake package (that supports COMPONENTS) consists of multiple package configuration files (Config.cmake or -config.cmake)?
The book from @craig.scott suggests to have one package configuration file with some logic inside to then include the relevant target files. In the internet one can find a few examples where multiple configuration files are used that are included in the root configuration file. Some components would have a dependency between each other and one does not have to use all components, but I guess this is self explanatory.
I highly appreciate any comment on this topic as I’m unsure how to move forward.
I’m actually wondering why there is no add_package
API to which targets can be added with e.g. package_link_target()
. The implementation of such a function could read all relevant information of a target plus it could accept additional find_package
calls for external dependencies. It seems that a lot of people are struggling with this and spent quite some time developing custom solutions. Maybe there are some aspects that I overlooked, but I would vote for such a feature
Thx,
Andi