target vs component based install

Working on modernizing a non-trivial monorepo with a significant amount of it’s own tooling (code gen, asset conversion, etc). As part of this I wanted to incorporate cmake tooling to build some of the tools and install them into their final locations in the monorepo.

For instance, we have a build target called “Pipeline” which builds all the tools, by depending on targets “CodeGen, Conversion, …, Distribution”. “CodeGen” has multiple sub-targets with multiple sub-targets…

Using install(...COMPONENT...) is not nothing, but it introduces duplications and - to get a semblance of the granularity we want - means repeating things in aggregate, which tends to encourage falling back to old-school “everything in variables” pattern.

Is there any facility for building meta-components or anything like that? You can reference a single component from multiple install()s, but you don’t appear to be able to do, e.g:

INSTALL(TARGETS executable COMPONENT App COMPONENT JustExe ...)
INSTALL(TARGETS library COMPONENT App COMPONENT JustLib ...)

This results in components JustExe and JustLib but not App.

@kyle.edwards has done some work with components before. Setting up component dependencies would be something I’d be interested in seeing (though no time to make it happen).

In the short term I’ll likely fall back on writing macros/functions to move stuff up and out of cmake so I can write my own install wrapper using a config file and allow the user to use target names consistently between build and install.