PDA

View Full Version : qmake how to switch compilation to use different mkspecs



Atomino
24th September 2007, 16:23
I am looking to compiling under X11 sometimes for X11 and sometimes for Win32.
So I know that it's possible to set environmnet variable QMAKESPEC or to set the option -spec with Qmake and delete the makefile, but I should want to use the .pro file, there is any possibility.

Thanks to all.

wysota
24th September 2007, 16:47
Without setting a spec before/during qmake is called it wouldn't be possible to determine what environment you are using, therefore what would be the advantages of setting the specs in the .pro file? You couldn't do the following:

win{
QMAKESPEC=...
}
unix {
QMAKESPEC=...
}
because scopes couldn't be evaluated this way...

Atomino
24th September 2007, 17:13
QMAKESPEC is an environment variable and qmake cannot set it.

wysota
24th September 2007, 17:42
That's not the point. I'm asking, how would you use the possibility to set specs from within the .pro file.

Atomino
25th September 2007, 08:27
I am using Eclipse with Qt integration, so the only way, I suppose, is to use Qt Project settings (.pro) to compile my project for X11 or Win32. I can set all the variables :

CONFIG
DESTDIR
FORMS
HEADERS
QT
RESOURCES
SOURCES
TEMPLATE
but I don't know how inform qmake using .pro to use different mkspecs.

The only way I found, is to do manually or to set QMAKESPEC or deleting makefile and running qmake -spec xxxx yyyy.pro

What I am looking for is to do automatically from Eclipse.

wysota
25th September 2007, 11:43
I don't know much about Eclipse, but you can probably create some button in Eclipse where you can assign a custom command. You can call qmake from within there. The thing you want to achieve is not a common thing people do. Usually if you want to create a makefile for a different platform, you'll do it once and not change between two specs again and again.