# (CPack) Package subdirectories into two packages

**URL:** https://discourse.cmake.org/t/cpack-package-subdirectories-into-two-packages/8646
**Category:** Usage
**Tags:** cpack:deb
**Created:** [July 31, 2023, 7:16am UTC](https://discourse.cmake.org/t/cpack-package-subdirectories-into-two-packages/8646 "2023-07-31T07:16:54Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Beanavil](https://discourse.cmake.org/user_avatar/discourse.cmake.org/beanavil/32/3659_2.png) [@Beanavil](https://discourse.cmake.org/u/Beanavil)
#### Post date: [July 31, 2023, 7:16am UTC](https://discourse.cmake.org/t/cpack-package-subdirectories-into-two-packages/8646/1 "2023-07-31T07:16:54Z")

</div>

I am working with 3 repositories, adding DEB packaging for the three of them. One of them (let’s call it project X) is packaged into two packages using two components: runtime and dev.

Now I have a repo that adds the three projects as subdirectories, and I want to package it as well. The idea is to have this repository packaged into two packages: `runtime` (with two of the subdirectories and the mentioned runtime component of project X) and `dev` (with the dev component of project X).

However, I have not been able to achieve this yet. I have tried two approaches so far:

- Activating the use of components in the project containing the other projects, CPack creates three packages: `runtime` (with the runtime component of project X), `dev` (with the dev component of project X) and `unspecified` (with the contents of the other two subdirectories).
- Activating the use of components in the project containing the other projects and specifying runtime and dev as the only components to be created, CPack creates two packages: `runtime` (with the runtime component of the project X) and `dev` (with the dev component of project X).

And I don’t know how I could specify that the other two subdirectories should be packaged in the runtime component (as they as added to the project with an `add_subdirectory(...)`.

---

<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: [July 31, 2023, 10:58pm UTC](https://discourse.cmake.org/t/cpack-package-subdirectories-into-two-packages/8646/2 "2023-07-31T22:58:15Z")

</div>

I think you need to make components that include the project name so that you can be more specific about what goes where.
