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

Orgad and Raizel Shaneh orgads at gmail.com
Sun May 13 07:39:35 CEST 2012


On Thu, May 10, 2012 at 10:36 PM, Duane Hebert
<duane.hebert at group-upc.com> wrote:
>
>
> On 05/10/2012 03:29 PM, Orgad and Raizel Shaneh wrote:
>>
>> On Thu, May 10, 2012 at 10:25 PM, Duane<duane.hebert at group-upc.com>
>>  wrote:
>>>
>>> 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:
>>> message($$QMAKESPEC)
>>>
>>>  linux-g++ {
>>>      message(Linux)
>>>  }
>>>
>>> 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
>>> message($$QMAKESPEC)
>>>
>>>  linux-g++ {
>>>      message(Linux)
>>>  }
>>>
>>> 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.
>>>
>>> _______________________________________________
>>> Qt-creator mailing list
>>> Qt-creator at qt-project.org
>>> http://lists.qt-project.org/mailman/listinfo/qt-creator
>>
>> There's an open report for that: QTBUG-22700. I think it's planned (or
>> maybe already implemented?) for Qt 5.0.
>>
>
> Thanks.  I wonder if there is a way to detect if X11 is defined?

You can test for mkspec, wildcards allowed. In you case:
linux-g++ {
 # X11
}
linux-x86-g++ {
 # framebuffer
}
linux-* {
 # both, excluding windows and mac
}

- Orgad



More information about the Qt-creator mailing list