I use CMake install(DIRECTORIES...)
form to copy headers on install:
install(DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}
DESTINATION include
FILES_MATCHING PATTERN "*.h")
However, this command does create empty directories (those where no headers are found). Thus, I want to find and delete those empty directories during the install process:
install(CODE "execute_process(
COMMAND find -type d -empty -exec rmdir '{}' ';'
WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}
ERROR_FILE ${CMAKE_CURRENT_BINARY_DIR}/prune_empty_dirs.err)")
With the command above, the file prune_empty_dirs.err
contains:
find: missing argument to `-exec'
I tried to escape the braces but it yields the same behavior. What am I doing wrong? Thanks,