(CPack) Package subdirectories into two packages

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(...).

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