I am using the following custom command to copy all the files within the config
directory into the build
directory. The problem is that I don't want the .svn
directory to be copied as well. I am looking for a way to either exclude the .svn
directory or to copy files with specific extension. e.g. I want only files with xml
or conf
extensions to be copied. What should I do?
add_custom_command(TARGET MyTarget PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/config $<TARGET_FILE_DIR:MyTarget>)
To copy just the
.xml
and.conf
files, you can use thefile(GLOB ...)
command:It's a similar process to get all files not in the
.svn
subdirectory: