Hello! How I can to check the Qt version dependency at the .pro-file?
In the pseudocode, I need something like this:
Qt Code:
if (QT_VERSION < 4.4) { show some message; abort configuration; }To copy to clipboard, switch view to plain text mode
Hello! How I can to check the Qt version dependency at the .pro-file?
In the pseudocode, I need something like this:
Qt Code:
if (QT_VERSION < 4.4) { show some message; abort configuration; }To copy to clipboard, switch view to plain text mode
read this
http://doc.trolltech.com/4.4/qmake-v...tml#qt-version
http://doc.trolltech.com/4.4/qmake-f...ablename-value
Qt Code:
contains(QT_VERSION, 4.4.1) { message(4.4.1) }To copy to clipboard, switch view to plain text mode
Last edited by spirit; 14th August 2008 at 19:19.
This is how we do it in LibQxt project:
It would be nice if there was a built-in version check function in qmake...Qt Code:
#check Qt version QT_VERSION = $$[QT_VERSION] QT_VERSION = $$split(QT_VERSION, ".") QT_VER_MAJ = $$member(QT_VERSION, 0) QT_VER_MIN = $$member(QT_VERSION, 1) lessThan(QT_VER_MAJ, 4) | lessThan(QT_VER_MIN, 2) { error(LibQxt requires Qt 4.2 or newer but Qt $$[QT_VERSION] was detected.) }To copy to clipboard, switch view to plain text mode
J-P Nurmi
Thanks a lot!
Yes, but that code is from 2008 when there was no Qt5 only Qt3 and Qt4. LibQxt no longer checks to exclude Qt3.
For Qt4+ you can just:
QT_MAJOR_VERSION, QT_MINOR_VERSION, and QT_PATCH_VERSION are defined for you.Qt Code:
greaterThan(QT_MAJOR_VERSION, 4) { } equals(QT_MAJOR_VERSION, 5) { } # or more complex stuff like equals(QT_MAJOR_VERSION, 4):lessThan(QT_MINOR_VERSION, 8) { }To copy to clipboard, switch view to plain text mode
Bookmarks