qt5base-lts/mkspecs/features/device_config.prf
Benoît Thébaudeau fe1ba87961 Fix QMAKE_CXX/CROSS_COMPILE verification with ccache
The use of ccache leads to QMAKE_CXX definitions of the form:

    QMAKE_CXX = $${CCACHE} $${CROSS_COMPILE}g++

The previous test required QMAKE_CXX to be a single valid (absolute or
QMAKE_PATH_ENV-relative) path to an existing file, which was not
compatible with definitions of QMAKE_CXX like the one above.

Fix this by using only the first value in QMAKE_CXX, which usually
points to the compiler executable, or to the ccache executable in the
above case.

Task-number: QTBUG-47951
Change-Id: Iade3136f03493593b067fb7742fb997f92377425
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-09-14 09:42:25 +00:00

47 lines
1.5 KiB
Plaintext

# This file is loaded by some qmakespecs to get early configuration data.
# Load generated qdevice.pri
DEVICE_PRI = $$[QT_HOST_DATA/get]/mkspecs/qdevice.pri
exists($$DEVICE_PRI):include($$DEVICE_PRI)
unset(DEVICE_PRI)
host_build {
CROSS_COMPILE =
} else: isEmpty(CROSS_COMPILE) {
#this variable can be persisted via qmake -set CROSS_COMPILE /foo
CROSS_COMPILE = $$[CROSS_COMPILE]
}
# Provide a function to be used by mkspecs
defineTest(deviceSanityCheckCompiler) {
equals(QMAKE_HOST.os, Windows): \
sfx = .exe
else: \
sfx =
# Build the compiler filename using the first value in QMAKE_CXX in order to
# support tools like ccache, which give QMAKE_CXX values of the form:
# ccache <path_to_compiler>
compiler = $$first(QMAKE_CXX)$$sfx
# Check if the binary exists with an absolute path. Do this check
# before the CROSS_COMPILE empty check below to allow the mkspec
# to derive the compiler path from other device options.
exists($$compiler):return()
# Check for possible reasons of failure
# check if CROSS_COMPILE device-option is set
isEmpty(CROSS_COMPILE):error("CROSS_COMPILE needs to be set via -device-option CROSS_COMPILE=<path>")
# Check if QMAKE_CXX points to an executable.
ensurePathEnv()
for (dir, QMAKE_PATH_ENV) {
exists($$dir/$${compiler}): \
return()
}
# QMAKE_CXX does not point to a compiler.
error("Compiler $$QMAKE_CXX not found. Check the value of CROSS_COMPILE -device-option")
}