Re: [Interest] Qmake: Detecting if QSerialPort is installed

2016-03-10 Thread André Hartmann

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)

?



___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Qmake: Detecting if QSerialPort is installed

2016-03-10 Thread 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)

?

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Qmake: Detecting if QSerialPort is installed

2016-03-10 Thread Koehne Kai


> -Original Message-
> From: Interest [mailto:interest-
> bounces+kai.koehne=theqtcompany@qt-project.org] On Behalf Of
> Koehne Kai
> Sent: Thursday, March 10, 2016 1:57 PM
> To: André Hartmann <andre.hartm...@iseg-hv.de>; Interest@qt-
> project.org
> Subject: Re: [Interest] Qmake: Detecting if QSerialPort is installed
> 
> 
> 
> > -Original Message-
> > From: Interest [mailto:interest-
> > bounces+kai.koehne=theqtcompany@qt-project.org] On Behalf Of
> > Andre Hartmann
> > Sent: Thursday, March 10, 2016 9:11 AM
> > To: Interest@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 
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Qmake: Detecting if QSerialPort is installed

2016-03-10 Thread Koehne Kai


> -Original Message-
> From: Interest [mailto:interest-
> bounces+kai.koehne=theqtcompany@qt-project.org] On Behalf Of
> Andre Hartmann
> Sent: Thursday, March 10, 2016 9:11 AM
> To: Interest@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)

Regards

Kai 
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Qmake: Detecting if QSerialPort is installed

2016-03-10 Thread André Hartmann

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?

Best regards,
Andre
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest