In my Qt project I'm trying to copy libraries as part of the build process. The goal is to have a ready made distribution after the build with all necessary dynamic libraries.
This seems acheivable with the INSTALLS variable, but I find the documentation a bit thin: qmake Variable Reference: INSTALLS
In the example given:
target
already defined, or is defined by writing target.path =
?.path
and ...?Building a Project For simple projects, you only need to run qmake in the top level directory of your project to generate a Makefile. You can then run your platform's make tool to build the project according to the Makefile.
qmake is a utility that automates the generation of makefiles. Makefiles are used by the program make to build executable programs from source code; therefore qmake is a make-makefile tool, or makemake for short.
The qmake tool helps simplify the build process for development projects across different platforms. It automates the generation of Makefiles so that only a few lines of information are needed to create each Makefile. You can use qmake for any software project, whether it is written with Qt or not.
Yeah, the docs have much to be desired here.
target
is already defined, but that is a special case. You can define your own additional deployment sets. Here is how we specify the image format plugins:
imageformats.path = /opt/some/path/bin/imageformats imageformats.files += $$[QT_INSTALL_DATA]/plugins/imageformats/*.so INSTALLS += imageformats
Here is the minimal documentation about the three commands: http://doc.qt.io/qt-4.8/qmake-environment-reference.html#installs
yourset.path = /path/in/which/to/install/files yourset.files = /files/to/install yourset.extra = custom commands to run, eg. `touch somefile.txt` INSTALLS += yourset
target
is whatever string you want to use. It is your own identifier.
target.files
defines what you want to install.
target.path
is the location (directory) you want to put the target.files
in.
For example, let's say I have a file called "config.xml" that I want to copy to the directory "xyzzy". I would use the following in my qmake .pro file to specify that.
my_file.files = config.xml my_file.path = xyzzy INSTALLS += my_file
BTW, to actually make the file copy, you will have to execute make install
.
You may also find the answer helpful in understanding: Copy a file to build directory.
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