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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With