Search both qmake and qmake-qt4

Some Linux distributions do not ship a "qmake" binary, despite
recommendations from the Qt Project. We need to cope with that, so we
search for qmake-qt4 if qmake fails.

We use "qmake -query QT_VERSION" instead of qmake -v because that is
known to produce an error for Qt 3's qmake.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Thiago Macieira 2013-05-14 15:23:39 -06:00 committed by Dirk Hohndel
parent d39b1aedcd
commit 2ba236e288

View file

@ -5,9 +5,6 @@ all:
PKGCONFIG=pkg-config
XML2CONFIG=xml2-config
XSLCONFIG=xslt-config
QMAKE=qmake
MOC=moc
UIC=uic
CONFIGFILE = config.cache
ifeq ($(CONFIGURING),1)
@ -70,6 +67,19 @@ endif
# about it if it doesn't.
LIBUSB = $(shell $(PKGCONFIG) --libs libusb-1.0 2> /dev/null)
# Find qmake. Rules are:
# - use qmake if it is in $PATH
# [qmake -query QT_VERSION will fail if it's Qt 3's qmake]
# - if that fails, try qmake-qt4
# - if that fails, print an error
# We specifically do not search for qmake-qt5 since that is not supposed
# to exist.
QMAKE = $(shell { qmake -query QT_VERSION >/dev/null 2>&1 && echo qmake; } || \
{ qmake-qt4 -v >/dev/null 2>&1 && echo qmake-qt4; })
ifeq ($(strip $(QMAKE)),)
$(error Could not find qmake or qmake-qt4 in $$PATH or they failed)
endif
# Use qmake to find out which Qt version we are building for.
QT_VERSION_MAJOR = $(shell $(QMAKE) -query QT_VERSION | cut -d. -f1)
ifeq ($(QT_VERSION_MAJOR), 5)