Use CMake components when installing
While modernising my CMake, I realised that dune-common dumps all the installation files into the same bucket. While this is practical because one does not have to think what to install and what not, it is much cleaner to split installation in different components. This way, the user has much more control over the objects that get installed on its system or package. Doing this is simple: Adding a
COMPONENT argument to every
install CMake call.
My proposal would be to have 4 components:
||Final scripts or binaries product of the module||Executables from application modules|
||Header files and build system mandatory to continue downstream development||Header files, cmake macros|
||Objects needed for both
||libraries for UGGrid or
||Documentation files||man pages, Doxygen|
In CMake, objects not assigned to any component are set to
Unspecified (current behaviour). With the proposed setting, nothing should be in this bucket.
Assuming components are set, installation of files in a given component is as simple as:
# User doesn't want to develop, just to link a final application cmake --install . --component Library # User wants to develop a downstream module cmake --install . --component Library --component Development # User wants to use final binaries cmake --install . --component Library --component Runtime # User wants to use everything (current behaviour) cmake --install .
Is this backwards compatible?
Yes! If no component is given on the command line (current usage), all components are installed. This means that the change is backwards compatible with any installation script out there.
Discussion... If there seems to be agreement/interest, I can push a MR.