summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/qmake/mkspecs/features/functions.prf13
1 files changed, 11 insertions, 2 deletions
diff --git a/build/qmake/mkspecs/features/functions.prf b/build/qmake/mkspecs/features/functions.prf
index 7b5ad6bbe..03e47bbc6 100644
--- a/build/qmake/mkspecs/features/functions.prf
+++ b/build/qmake/mkspecs/features/functions.prf
@@ -57,8 +57,17 @@ defineReplace(rccExternFunc) {
defineReplace(which) {
out = $$1
- # FIXME: figure out what to do about windows...
- unix {
+ win32 {
+ command = $$split(out, " ")
+ executable = $$first(command)
+ # Return the first match only
+ out = $$system("((for /f \"usebackq delims=\" %i in (`where $$executable 2^> NUL`) do @if not defined _endwhich (@echo %i & set _endwhich)) & set _endwhich=)")
+ isEmpty(out) {
+ message($$executable not found)
+ out = $$executable
+ }
+ for(arg, command): !equals(arg, $$executable): out += $$arg
+ } else:unix {
command = $$split(out, " ")
executable = $$first(command)
out = $$system("which $$executable 2>/dev/null")