On Sunday 31 of May 2020 23:23:24 deloptes wrote:
I found following to be the best solution, although I did not want to use exclude
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DESTINATION ${INCLUDE_INSTALL_DIR}/<generated> USE_SOURCE_PERMISSIONS FILES_MATCHING PATTERN PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE)
it just fits perfect
Hi,
instead of a solution with install( DIRECTORY ... ), enumerating EXCLUDE and hoping that something unexpected does not arise there, I recommend using file( GLOB ... ) and installing only what is directly required:
file( GLOB _generated_headers ${CMAKE_CURRENT_BINARY_DIR}/*.h ) install( FILES ${_generated_headers} DESTINATION ${INCLUDE_INSTALL_DIR}/<app>/ )
This also allows you to easily add a list ${_generated_headers} to other installed files to use a single install( FILES ... ) for installation of both static and generated headers.
Cheers