Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 3

Qt-interest Archive, July 2007
Checking for QT version in .pro file?


Message 1 in thread

Is there some way to have a conditional on the QT version in the .pro 
file? Similar to the unix {} and win32 {} blocks?
I have a few objects that depend on Qt 4.3, and I've found no safe way 
to specify that the moc file should be built only on Qt 4.3. If I try to 
insert
#if QT_VERSION >= 0x040300
in the header, moc happily generates an empty file both for Qt 4.2 and 4.3.

--
 [ signature omitted ] 

Message 2 in thread

Thorvald Natvig wrote:
> Is there some way to have a conditional on the QT version in the .pro 
> file? Similar to the unix {} and win32 {} blocks?
> I have a few objects that depend on Qt 4.3, and I've found no safe way 
> to specify that the moc file should be built only on Qt 4.3. If I try 
> to insert
> #if QT_VERSION >= 0x040300
> in the header, moc happily generates an empty file both for Qt 4.2 and 
> 4.3.
>
> -- 
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
I think this should work

QT_VERSION=$$[QT_VERSION]

contains( QT_VERSION, "^4.*" ) {
  do something
} else {
 do something else
}

--
 [ signature omitted ]