PDA

View Full Version : QMake Check for Qt version in QMake



PaladinOfKaos
15th April 2010, 04:21
I have a CMake file that checks the Qt version and adds the QtIconLoader sources if the version is < 4.6 (4.6 or above the native FD.o icon loading is used).

A user contributed a QMake file that hard-codes the qticonloader sources. It shouldn't cause a problem, the code goes totally unused if the Qt version is 4.6 or higher, but it seems just generally unclean to compile them when not needed.

So to my question... What's the syntax to do a Qt version check in QMake? Something like


<what goes here to check the version?> {
SOURCES += 3rdparty/qticonloader/qticonloader.cpp
HEADERS += 3rdparty/qticonloader/qticonloader.h
}

GNU Dimarik
24th October 2010, 14:41
#version check qt
contains(QT_VERSION, ^4\\.[0-6]\\..*) {
message("Cannot build Qt Creator with Qt version $${QT_VERSION}.")
error("Use at least Qt 4.7.")
}

From qtcreator.pro