# # Copyright (c) 2010-2015 Illumina, Inc. # All rights reserved. # # This file is distributed under the simplified BSD license. # The full text can be found here (and in LICENSE.txt in the root folder of # this distribution): # # https://github.com/Illumina/licenses/blob/master/Simplified-BSD-License.txt # Copy files from source directory to destination directory, substituting any # variables. Create destination directory if it does not exist. macro(configure_files srcDir srcGlob destDir) message(STATUS "Copying directory ${destDir}") make_directory(${destDir}) file(GLOB_RECURSE templateFiles RELATIVE ${srcDir} "${srcDir}/${srcGlob}") foreach(templateFile ${templateFiles}) set(srcTemplatePath ${srcDir}/${templateFile}) if(NOT IS_DIRECTORY ${srcTemplatePath}) message(STATUS "Copying file ${templateFile} -> ${destDir}/${templateFile}") configure_file( ${srcTemplatePath} ${destDir}/${templateFile} COPYONLY) endif(NOT IS_DIRECTORY ${srcTemplatePath}) endforeach(templateFile) endmacro(configure_files) # copy files via target macro(copy_files GLOBPAT DESTINATION) file(GLOB COPY_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${GLOBPAT}) add_custom_target(copy ALL COMMENT "Copying files: ${GLOBPAT}") foreach(FILENAME ${COPY_FILES}) set(SRC "${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}") set(DST "${DESTINATION}/${FILENAME}") add_custom_command( TARGET copy COMMAND ${CMAKE_COMMAND} -E copy ${SRC} ${DST} ) endforeach(FILENAME) endmacro(copy_files)