# Opinion on multiple configuration files when using COMPONENTS of find\_package

**URL:** https://discourse.cmake.org/t/opinion-on-multiple-configuration-files-when-using-components-of-find-package/11387
**Category:** Code
**Created:** [August 5, 2024, 4:03pm UTC](https://discourse.cmake.org/t/opinion-on-multiple-configuration-files-when-using-components-of-find-package/11387 "2024-08-05T16:03:35Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![andi\_schacherbauer](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/a/b5e925/32.png) [@andi\_schacherbauer](https://discourse.cmake.org/u/andi_schacherbauer)
#### Post date: [August 5, 2024, 4:03pm UTC](https://discourse.cmake.org/t/opinion-on-multiple-configuration-files-when-using-components-of-find-package/11387/1 "2024-08-05T16:03:35Z")

</div>

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
