summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-08-04 11:01:25 +0200
committerLiang Qi <liang.qi@qt.io>2017-08-11 06:38:56 +0000
commit49cb039a5c15d434514e81a7573778c8b2db566a (patch)
treed877f72af71c4e1d31381f8dd042dfab17106c50
parentfeb24153633859502f30bc16b149c78fb1d651b7 (diff)
make compiler invocation error messages mention host/target
it's unclear where to look for the error when the message talks about 'g++' when '${CROSS_COMPILE}g++' would have been expected. help it by saying whether it was supposed to be the host or target compiler. this also centralizes the error emissions in a function. Change-Id: I454c6ff7c0e7dd945dcee0de01e2818caeeb7409 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
-rw-r--r--mkspecs/features/toolchain.prf22
1 files changed, 14 insertions, 8 deletions
diff --git a/mkspecs/features/toolchain.prf b/mkspecs/features/toolchain.prf
index 813dbffbd4..21c18c7f7b 100644
--- a/mkspecs/features/toolchain.prf
+++ b/mkspecs/features/toolchain.prf
@@ -12,6 +12,16 @@ defineReplace(qtMakeExpand) {
}
}
+defineTest(qtCompilerErrror) {
+ !cross_compile: \
+ what =
+ else: host_build: \
+ what = " host"
+ else: \
+ what = " target"
+ error("Cannot run$$what compiler '$$1'. Maybe you forgot to setup the environment?")
+}
+
cross_compile:host_build: \
target_prefix = QMAKE_HOST_CXX
else: \
@@ -58,8 +68,7 @@ isEmpty($${target_prefix}.INCDIRS) {
cxx_flags += -E -v
output = $$system("$$cmd_prefix $$QMAKE_CXX $$qtMakeExpand($$cxx_flags) -xc++ - 2>&1 $$cmd_suffix", lines, ec)
- !equals(ec, 0): \
- error("Cannot run compiler '$$QMAKE_CXX'. Maybe you forgot to setup the environment?")
+ !equals(ec, 0): qtCompilerErrror($$QMAKE_CXX)
rim_qcc {
for (line, output) {
@@ -119,8 +128,7 @@ isEmpty($${target_prefix}.INCDIRS) {
# What's more, -print-search-dirs can't be used on clang on Apple because it
# won't print all the library paths (only the clang-internal ones).
output = $$system("$$cmd_prefix $$QMAKE_CXX -print-search-dirs", lines, ec)
- !equals(ec, 0): \
- error("Cannot run compiler '$$QMAKE_CXX'. Maybe you forgot to setup the environment?")
+ !equals(ec, 0): qtCompilerErrror($$QMAKE_CXX)
for (line, output) {
contains(line, "^libraries: .*") {
@@ -162,8 +170,7 @@ isEmpty($${target_prefix}.INCDIRS) {
defineReplace(qtVariablesFromMSVC) {
ret = $$system("$$1 -nologo -E $$2 $$system_quote($$PWD/data/macros.cpp) <NUL 2>NUL", lines, ec)
- !equals(ec, 0): \
- error("Cannot run compiler '$$1'. Maybe you forgot to setup the environment?")
+ !equals(ec, 0): qtCompilerErrror($$1)
return($$ret)
}
@@ -171,8 +178,7 @@ defineReplace(qtVariablesFromGCC) {
null_device = /dev/null
equals(QMAKE_HOST.os, Windows): null_device = NUL
ret = $$system("$$1 -E $$system_quote($$PWD/data/macros.cpp) <$$null_device 2>$$null_device", lines, ec)
- !equals(ec, 0): \
- error("Cannot run compiler '$$1'. Maybe you forgot to setup the environment?")
+ !equals(ec, 0): qtCompilerErrror($$1)
return($$ret)
}