[CMake] How to copy directory as part of custom target, filtering out .svn dirs?

Rick Gould rick at transpireinc.com
Mon Jun 21 16:34:43 EDT 2010


I'm looking to install a directory as part of a custom target, but
exclude all the Subversion .svn directories.

Both of the the following work, but run as part of the "make install"
target, which I don't want:

   install( DIRECTORY ${source_dir}
      DESTINATION ${destination_dir}
      PATTERN .svn EXCLUDE
   )

   file( COPY ${source_dir}
      DESTINATION ${destination_dir}
      PATTERN .svn EXCLUDE
   )


The following would work, if there was a way to exclude .svn dirs as
part of the copy_directory:

   add_custom_command(
      OUTPUT  ${destination_dir}
      COMMAND ${CMAKE_COMMAND} -E copy_directory ${source_dir}
${destination_dir}
   )


Any suggestions?

Thanks very much!

 - Rick Gould

rick at transpireinc.com


More information about the CMake mailing list