PDA

View Full Version : QMake make install problems



cookiem
8th November 2006, 11:04
Hi,

I am trying to use QMake's INSTALLS variable, but it adds files to innstall (in Makefile), only if the files have been already created.
The problem i have that out file is not compiled yet, right. So QMake does not add this file to install list. Is there any way to force QMake to use not created yet files in install?

wysota
8th November 2006, 12:10
What do you mean by "not created yet"? When do you want to create them?

cookiem
8th November 2006, 13:05
What do you mean by "not created yet"? When do you want to create them?

The project is a lib, i want that make install will cp all .so to /usr/lib, but so file is created only after i run 'make', if those files are not created yet QMake does not add them to the install list. So when i run 'make install' only headers are copied.
If i run 'make', then 'qmake -makefile' and then 'make install' only then .so files are in Makefile and copied to /usr/lib

Sorry, i hope it's clear enough now.

wysota
8th November 2006, 14:30
Ok, I take it that the library name is held in the TARGET variable as usual. Then all you have to do is add the following to your project file:

target.path = /usr/lib
INSTALLS += target

cookiem
8th November 2006, 14:45
Ok, I take it that the library name is held in the TARGET variable as usual. Then all you have to do is add the following to your project file:

target.path = /usr/lib
INSTALLS += target

It was a custom variable. Now it works!

Thank You very much!

Comer352l
2nd December 2008, 14:38
I made the same mistake and used a custom name...:confused::(

However, I have some additional questions:

1.) If I add a line

target.files += file1 file2 file3

it doesn't work anymore. Why not ? Is the usage of += not allowed ?

2.) In addition to the application binary I want to install the *.qm language file (which are not yet created when calling qmake, too). How can I do that ?

3.) Where can I find a complete documentation about all these variables ?
Especially a list of all reserved names (like "target") and the available fields (.path, .files, .depends, .comands, ...) would be very helpful.

wysota
2nd December 2008, 20:26
You can create a separate installation point, independant of target. Then you can use variables. Just make sure the files you add to it are contained in a separate variable and add that variable instead of separate files.

Comer352l
3rd December 2008, 11:41
What do you mean when you talk about a separate "installation point" ? I tried the following



QMFILES = file1.qm file2.qm file3.qm
target.path = /opt/myapp
tstarget.path = /opt/myapp
tstarget.files = $$QMFILES
INSTALLS += target tstarget


but it doesn't work :o.

wysota
4th December 2008, 00:35
The following works for me just fine:

INSTALL_HEADERS += widgets/wwglobal.h
INSTALL_HEADERS += $$wwHeaders(WWWIDGETS)

flat_headers.files = $$INSTALL_HEADERS
flat_headers.path = $$[QT_INSTALL_HEADERS]/wwWidgets
INSTALLS += flat_headers

Comer352l
4th December 2008, 10:15
Thank you for your reply, but I don't know how to apply this to my problem.
I don't have any header-files and also no environment value like WWWIDGETS...

Could you give another short example with just a simple application myApp and two translation binaries file1.qm and file2.qm ?

wysota
4th December 2008, 11:22
This is a real world example, ignore the variable names, focus on the syntax. In my case INSTALL_HEADERS contains a list of files to copy, that's all you need to know.

In your case it'd be something like:
INSTALL_TRANSLATIONS += file1.qm file2.qm
transinstall.files = $$INSTALL_TRANSLATIONS
transinstall.path = /opt/something
INSTALLS+=transinstall

Remember that you have to run qmake after files file1.qm and file2.qm are created for this to work.

Comer352l
4th December 2008, 11:54
Remember that you have to run qmake after files file1.qm and file2.qm are created for this to work.

But that's the point ! qm-files are create during make and make is called after qmake...
So I have to call qmake twice during the build+installation process !

qmake => creates makefiles
make => builds application binaries
make translation => creates translation binaries (qm-files)
qmake => creates makefiles again !!!
make install => installs application+translation binaries

The problem is, that the first qmake ignores all install-target files that are not yet built.
For the application binary, Trolltech seems to have implemented a "special" solution with the reserved "target" target.
But there seems to be no such a solution for other files, right ? :(:(:(

wysota
4th December 2008, 15:34
But that's the point ! qm-files are create during make and make is called after qmake...
So I have to call qmake twice during the build+installation process !
qm files are not created by make. At least not by default - qm files are created by calling lrelease on the project file. You don't need to recreate qm files during every compilation, only once during a final release (you can work on ts files in the meantime). I'm sure calling qmake once more in this situation is not a problem.