如何使用 qmake 递归复制文件
在我的源代码树中,我有很多资源,我想使用 make install 将它们复制到我定义的目标路径。由于资源树有很多很多子目录,我希望 qmake 递归地查找所有文件。
我尝试过:
resources.path = /target/path
resources.files += `find /path/to/resources`
INSTALLS += resources
和:
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
两者都没有达到我希望的结果。
In my source tree I have a bunch of resources, I want to copy them with make install to my defined target path. Since the resource tree has many, many subdirectories, I want qmake to find all files recursively.
I tried:
resources.path = /target/path
resources.files += `find /path/to/resources`
INSTALLS += resources
and:
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
Both don't have the result I was hoping for.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我是这样做的:
这会将
"无论此 qmake 脚本在哪里"/sourcefolder
复制到buildfolder/"构建目录上的相同子文件夹"/targetfolder
这样你就可以了
targetfolder/sourcefolder/"所有其他子文件夹和文件..."
示例:
将
/mysources/extras
复制到/project_build/extras
并/mysources/src
到/project_build/src
I have done it like this:
this would copy
"wherever this qmake script is"/sourcefolder
intobuildfolder/"same sub folder on build dir"/targetfolder
so you would have
targetfolder/sourcefolder/"all other subfolders and files..."
Example:
Would copy
/mysources/extras
to/project_build/extras
and/mysources/src
to/project_build/src
看起来目录是用“cp -r -f”安装的,所以这可以解决问题:
It appears that directories are installed with 'cp -r -f', so this does the trick: