Add the possibility to install nested headers automatically
My use case: I package a development version of a binary package for Debian. I have headers in my source directory (they could be imported), that are spread across multiple nested sub-directories. I am looking for a handy way to preserve the directory structure of my headers when installing them.
Let's say the source directory of my project has myProjectSource/some/path/to/a/bunch/of/headers
I want to cut the bunch of grapes at the origin directory of my choosing, i.e. 'a'. That gives a relative path bunch/of/headers
. I want the relative paths, of the N headers found in there, to be installed in the appropriate GNUInstallDirs: ${CMAKE_INSTALL_INCLUDEDIR}(/bunch/of/headers)
. And repeat the process for the next header "superdir" and its own nested headers.
As far as I understood, PUBLIC_HEADER flattens all in one directory which is not suited to FHS installations where headers are allowed to be nested and often do so. install(FILE/DIRECTORY)
is not fathomable given the elegance of install(TARGET myTarget)
that modern cmake strives for. All the while keeping the useful differentiation between private and public headers.