[Interest] Qmake: Detecting if QSerialPort is installed

André Hartmann andre.hartmann at iseg-hv.de
Thu Mar 10 15:16:40 CET 2016


Hi Thiago,

This looks like the best solution. I already get a message when load() 
fails*, and I can use it as test expression for conditional compile.

Maybe the wiki https://wiki.qt.io/Qt_Serial_Port
should be updated, as load() seems the best way to do it.

@Kai: QT_CONFIG seems to include everything Qt was build with, but 
QtSerialPort is an "add-on" for Qt 4 that has to be build against the 
installed Qt version.

Best regards,
Andre

* I don't fully memorize the message because I tested it on an other 
computer.

Am 10.03.2016 um 14:48 schrieb Thiago Macieira:
> On quinta-feira, 10 de março de 2016 09:10:49 PST André Hartmann wrote:
>> Hi all,
>>
>> I'm working on a library that (optionally) depends on QSerialPort.
>>
>> This library should also compile on Qt 4, so I did the following in the
>> project file:
>>
>> greaterThan(QT_MAJOR_VERSION, 4) {
>>           QT += serialport
>> } else {
>>           CONFIG += serialport
>> }
>>
>> Thats fine so far, but if QSerialPort is not installed for the
>> corresponding Qt4 version, I'd like to get a message during the qmake run.
>
> What happens if, instead of that CONFIG += serialport, you write:
>
> load(serialport)
>
> ?
>




More information about the Interest mailing list