如何将目录从源代码树复制到二叉树? [英] How to copy directory from source tree to binary tree?

查看:192
本文介绍了如何将目录从源代码树复制到二叉树?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将目录从源树复制到二进制树。例如:如何将www复制到bin文件夹。

Copying directory from source tree to binary tree. For example: How to copy www to bin folder.

work
├─bin
└─src
    ├─doing
    │  └─www
    ├─include
    └─lib

感谢。

推荐答案

使用CMake 2.8,使用 文件(COPY ...) 命令。

With CMake 2.8, use the file(COPY ...) command.

对于较旧的CMake版本,此宏将文件从一个目录复制到另一个目录。如果您不想替换复制文件中的变量,请更改configure_file @ONLY参数。

With older CMake versions, this macro copies files from one directory to another. If you don't want to substitute variables in the copied files, change the configure_file @ONLY argument.

# Copy files from source directory to destination directory, substituting any
# variables.  Create destination directory if it does not exist.

macro(configure_files srcDir destDir)
    message(STATUS "Configuring directory ${destDir}")
    make_directory(${destDir})

    file(GLOB templateFiles RELATIVE ${srcDir} ${srcDir}/*)
    foreach(templateFile ${templateFiles})
        set(srcTemplatePath ${srcDir}/${templateFile})
        if(NOT IS_DIRECTORY ${srcTemplatePath})
            message(STATUS "Configuring file ${templateFile}")
            configure_file(
                    ${srcTemplatePath}
                    ${destDir}/${templateFile}
                    @ONLY)
        endif(NOT IS_DIRECTORY ${srcTemplatePath})
    endforeach(templateFile)
endmacro(configure_files)

这篇关于如何将目录从源代码树复制到二叉树?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆