如何使用qmake递归复制文件

Jer*_*oen 5 qmake

在我的源代码树中,我有一堆资源,我想用make install将它们复制到我定义的目标路径.由于资源树有许多子目录,我希望qmake以递归方式查找所有文件.

我试过了:

   resources.path = /target/path
   resources.files += `find /path/to/resources`
   INSTALLS += resources
Run Code Online (Sandbox Code Playgroud)

和:

    resources.path = /target/path
    resources.files += /path/to/resources/*
    resources.files += /path/to/resources/*/*
    resources.files += /path/to/resources/*/*/*
    resources.files += /path/to/resources/*/*/*/*
    INSTALLS += resources
Run Code Online (Sandbox Code Playgroud)

两者都没有我希望的结果.

Jer*_*oen 2

看起来目录是用“cp -r -f”安装的,所以这可以解决问题:

resources.path = /target/path
resources.files += /path/to/resources/dir1
resources.files += /path/to/resources/dir2
resources.files += /path/to/resources/dir3 
resources.files += /path/to/resources/dirn # and so on...
resources.files += /path/to/resources/*    # don't forget the files in the root
INSTALLS += resources
Run Code Online (Sandbox Code Playgroud)