how-to-export-cpp-library icon indicating copy to clipboard operation
how-to-export-cpp-library copied to clipboard

Install header directory preserving the original hierarchy

Open claudiofantacci opened this issue 8 years ago • 1 comments

The current version of the LibTemplateCmake CMakeLists.txt uses PUBLIC_HEADER to list and install the header of the library. While this approach is clean and straightforward, the process does not preserve the header folder hierarchy and, instead, install all header files in the same directory.

A simple workaround is to delete PUBLIC_HEADER property and use a install(DIRECTORY /path/of/include/dir DESTINATION /install/path/of/include/dir).

Is this solution sufficiently clean and satisfactory for most of the situation? While this solution works smoothly, it undermines how to (I quote):

Specify public header files in a FRAMEWORK shared library target.

claudiofantacci avatar May 10 '17 10:05 claudiofantacci

This may be useful too: https://gitlab.kitware.com/cmake/cmake/-/issues/16739

jkoutavas avatar Mar 19 '21 16:03 jkoutavas