[Interest] Qmake: Detecting if QSerialPort is installed
Koehne Kai
Kai.Koehne at theqtcompany.com
Thu Mar 10 14:00:54 CET 2016
> -----Original Message-----
> From: Interest [mailto:interest-
> bounces+kai.koehne=theqtcompany.com at qt-project.org] On Behalf Of
> Koehne Kai
> Sent: Thursday, March 10, 2016 1:57 PM
> To: André Hartmann <andre.hartmann at iseg-hv.de>; Interest at qt-
> project.org
> Subject: Re: [Interest] Qmake: Detecting if QSerialPort is installed
>
>
>
> > -----Original Message-----
> > From: Interest [mailto:interest-
> > bounces+kai.koehne=theqtcompany.com at qt-project.org] On Behalf Of
> > Andre Hartmann
> > Sent: Thursday, March 10, 2016 9:11 AM
> > To: Interest at qt-project.org
> > Subject: [Interest] Qmake: Detecting if QSerialPort is installed
> >
> > 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's the easiest way to do this with qmake?
>
> You can use qtHaveModule() to check for a Qt module, and message(),
> error(), warning() ... to print stuff.
>
> !qtHaveModule(serialport): error(Qt SerialPort module not found)
... which will work for Qt 5. I missed that you asked about Qt 4, sorry about that.
Does QT_CONFIG contain "serialport" in Qt 4?
Regards
Kai
More information about the Interest
mailing list