I\'m new to cmake
and I\'m trying to install .hpp
files while preserving directory structure.
So far I have
FILE(GLOB files \"$
You can use the DIRECTORY variant of the CMake install command. This command will preserve the structure of the copied directory:
install(DIRECTORY include/ DESTINATION include
FILES_MATCHING PATTERN "*.hpp")
If the directory to be copied contains subdirectories that should not be installed, you'll have to explicitly exclude those with a PATTERN EXCLUDE option:
install(DIRECTORY include/ DESTINATION include
FILES_MATCHING PATTERN "*.hpp"
PATTERN "include/MyOtherLib" EXCLUDE)