Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I specify input the QMake INSTALLS variable?

Tags:

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:

  • Is target already defined, or is defined by writing target.path =?
  • Where is the documentation for possible members? .path and ...?
like image 471
Eirik M Avatar asked Feb 21 '12 12:02

Eirik M


People also ask

How do you qmake in Qt?

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.

What is qmake command?

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.

What does run qmake do?

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.


2 Answers

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 
like image 134
Dave Mateer Avatar answered Sep 20 '22 14:09

Dave Mateer


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.

like image 26
jwernerny Avatar answered Sep 20 '22 14:09

jwernerny