# adding component to existing namespace/package

**URL:** https://discourse.cmake.org/t/adding-component-to-existing-namespace-package/8670
**Category:** Usage
**Created:** [August 3, 2023, 8:46am UTC](https://discourse.cmake.org/t/adding-component-to-existing-namespace-package/8670 "2023-08-03T08:46:21Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![adaldev](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/a/9dc877/32.png) [@adaldev](https://discourse.cmake.org/u/adaldev)
#### Post date: [August 3, 2023, 8:46am UTC](https://discourse.cmake.org/t/adding-component-to-existing-namespace-package/8670/1 "2023-08-03T08:46:21Z")

</div>

Hi,

Let say I’ve already got a bunch of libraries that can be link into other project by:

```cmake
find_package(PackageName COMPONENTS Comp1 Comp2...)

```

How can I make another library project that can be added to PackageName as a new component (without touching existing projects: for instance, I may want to allow third party contributors to add component to an existing package)?

I hope that the question is clear enough,  
A.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [August 3, 2023, 4:51pm UTC](https://discourse.cmake.org/t/adding-component-to-existing-namespace-package/8670/2 "2023-08-03T16:51:08Z")

</div>

`PackageName`’s configuration would have to use the given `COMPONENTS` names to do the search for you. There’s nothing built-in to allow for this.

---

<div class="post-metadata">

### Author: ![adaldev](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/a/9dc877/32.png) [@adaldev](https://discourse.cmake.org/u/adaldev)
#### Post date: [August 4, 2023, 8:10am UTC](https://discourse.cmake.org/t/adding-component-to-existing-namespace-package/8670/3 "2023-08-04T08:10:52Z")

</div>

Hi,

I just see a similar question to which you seem to give the opposite answer: [Using the same namespace for multiple independant projects - #2 by ben.boeckel](https://discourse.cmake.org/t/using-the-same-namespace-for-multiple-independant-projects/8669/2)  
Can you clarify?  
Or how can I edit local PackageName’s configuration file to declare the new components (ideally directly from the new library cmake project)?

Regards,  
A.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [August 7, 2023, 11:22am UTC](https://discourse.cmake.org/t/adding-component-to-existing-namespace-package/8670/4 "2023-08-07T11:22:48Z")

</div>

Not sure I understand where the opposite answer is provided. There’s no rule about `NAMESPACE` needing to be unique. However, there’s also nothing that makes a single project understand everything that does share a `NAMESPACE`.

The config file could have something like:

```cmake
foreach (component IN LISTS other_components)
  find_package("project_${component}" QUIET)
  if (found)
    set(project_${component}_FOUND 1)
  else ()
    set(project_${component}_FOUND 0)
  endif ()
endforeach ()

```
