开发者

How can I use qmake to copy files recursively

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.f开发者_运维技巧iles += /path/to/resources/*/*/*/*
    INSTALLS += resources

Both don't have the result I was hoping for.


I have done it like this:

res.path = $$OUT_PWD/targetfolder
res.files = sourcefolder

INSTALLS += res

this would copy "wherever this qmake script is"/sourcefolder into buildfolder/"same sub folder on build dir"/targetfolder

so you would have targetfolder/sourcefolder/"all other subfolders and files..."

Example:

#(My .pro file's dir) $$PWD = /mysources/
#(My Build dir)       $$OUT_PWD = /project_build/


extras.path = $$OUT_PWD
extras.files += extras
src.path = $$OUT_PWD
src.files += src

INSTALLS += extras src

Would copy /mysources/extras to /project_build/extras and /mysources/src to /project_build/src


It appears that directories are installed with 'cp -r -f', so this does the trick:

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜