I am aware of the different options available for the install option currently. I am asking what it’s intended purpose is because it seems unusable for the use case I imagine, and I assume that I am wrong. I guess I am feeling out a feature request here.
consider my current application. I have a hierarchical project structure like this:
I am assuming here that all sub-projects are nice and assign their install components as dev/runtime. Red projects are implementation details while green projects contribute to the public interface of MyLib. In my actual project there are a few more layers but LibC is something like microsoft-gsl
and thier gsl::span
is in the interface of MyLib. LibD is a wonky internal library that nobody would ever want to install into their system but is required for the internal workings of this larger library.
Given this project if I run cmake --install .
then ALL 10 components are installed to the system. In reality a developer would only want
cmake --install . --component MyLib_dev --component MyLib_runtime --component libC_dev --component libC_runtime
(can we even have multiple component commands?)
Now consider if MyLib is actually MyApp and LibA is a shared library (forgive me for not redrawing). Then what we actually want to install is cmake --install . --component MyApp_runtime --component libA_runtime
This makes the cmake --install
command hard to use correctly, and easy to use incorrectly. It seems like a useful feature would be commands similar to the cpack commands but for wrangling components for the install command. consider cpack_add_component()
and it’s ability to add dependencies to a component. Consider the following hypothetical commands, where I am really just stealing CPack syntax
cmake_add_install_type(developer)
cmake_install_component(MyLib_dev
DEPENDS MyLib_runtime libC_dev
INSTALL_TYPES developer
)
then simply running cmake --install . --component developer
or maybe `cmake --install . --type developer’.