qt5base-lts/mkspecs/features/device_config.prf
Oswald Buddenhagen 3444e23652 make QMAKE_CXX/CROSS_COMPILE verification work under windows
automatically append the .exe extension. this is done unconditionally,
which means that providing it in the spec is wrong by definition.

don't use system("which") (which won't do what we want in a windows
shell), but scan PATH ourselves. as a bonus, this is also faster.

to avoid fetching and splitting the path multiple times, factor out a
function in spec_pre.prf.

Change-Id: I95f0fa285c158b347d45422111f91540e3a595fd
Reviewed-by: Jochen Seemann <seemann.jochen@gmail.com>
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2015-04-21 12:05:50 +00:00

42 lines
1.3 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 =
# 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($$QMAKE_CXX$$sfx):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/$${QMAKE_CXX}$$sfx): \
return()
}
# QMAKE_CXX does not point to a compiler.
error("Compiler $$QMAKE_CXX not found. Check the value of CROSS_COMPILE -device-option")
}