summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZoltan Arvai <zarvai@inf.u-szeged.hu>2013-11-20 09:15:38 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-20 13:07:10 +0100
commitc502cd17441336c4595f1c9373867dcb0d956c01 (patch)
tree8e158d156383c481c86eb387c57676d983754722
parente56db54f628d788b73100bf0a3ec22ce91d3a82f (diff)
Add which method to functions.prf for Windows.
On Windows the where util is similar to which, but it can return multiple matches so only the first one is selected. Change-Id: I55953ce5dd4940a37ab4fae7baa78dd2deed1085 Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
-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")