summaryrefslogtreecommitdiffstats
path: root/mkspecs/features/toolchain.prf
diff options
context:
space:
mode:
Diffstat (limited to 'mkspecs/features/toolchain.prf')
-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)
}