[Qt-creator] Detecting different build configurations in the .pro file

Duane duane.hebert at group-upc.com
Thu May 10 21:25:49 CEST 2012

On 05/10/2012 11:11 AM, Daniel Teske wrote:
> On Thursday 10 May 2012 16:35:16 ext Duane wrote:
>> We're building for an embedded linux device.  I have a build of qt libs
>> using the linux frame buffer instead of x and a build of qt using the
>> regular linux desktop stuff.  For development I build with the desktop
>> version.  For deployement and hardware testing I build with the frame
>> buffer version.  This works well.
>> The trouble is that I have some static libs for qwt and
>> qtsingleapplication, among others that when built, use conditional
>> builds based on Win32 or X11.  So when built for linux they use X11 but
>> when I'm building my app for the target, there is no X11.  So I have
>> builds of the libs with the frame buffer version of qt as well.  This
>> also works but I have to modify the .pro file each time that I change
>> build types.
>> What I'd like to do is somehow in my project file include one version
>> lib or another based on which build I'm doing.  I was thinking maybe
>> using the mkspec or something.  The frame buffer version uses
>> qws/linux-... as opposed to just linux..
>> Any idea how to achieve this or is it not possible?
> See http://qt-project.org/doc/qt-4.8/qmake-advanced-usage.html
> You can probably use what is described under "Platform Scope Values"

Well I thought that I could use something like the example:

  linux-g++ {

because when looking at the makespec from the build configuration, the 
one for the frame buffer shows qws/linux-x86-g++ and the desktop one 
shows linux-g++.

But when I add

  linux-g++ {

qws/linux-x86-g++ {
     message(Linux frame buffer)

to the .pro file, the output that I see is:
Project MESSAGE:
Project MESSAGE: Linux

So it seems that $$QMAKESPEC is null.

More information about the Qt-creator mailing list