Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use qmake to copy files recursively

Tags:

qmake

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.

like image 506
Jeroen Avatar asked May 11 '11 10:05

Jeroen


2 Answers

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

like image 194
Logan Avatar answered Nov 05 '22 13:11

Logan


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
like image 2
Jeroen Avatar answered Nov 05 '22 15:11

Jeroen