aboutsummaryrefslogtreecommitdiff
path: root/devel/qbs/files/patch-27bd9ac.diff
blob: bd61d639e203b52fd0e575b49d116b08e450f08f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
This comes from the upstream issue
	https://bugreports.qt.io/browse/QBS-1672
and is the diff available at
	https://codereview.qt-project.org/c/qbs/qbs/+/371943

adridg@: I have added the `versions` part of the code, that
additionally looks for -qt5 (which we have) and unsuffixed
and -qt (neither of which we have) executables. This matches
the code in the setupqt.cpp files, elsewhere.

diff --git a/share/qbs/module-providers/Qt/setup-qt.js b/share/qbs/module-providers/Qt/setup-qt.js
index b1239a7..422863b 100644
--- share/qbs/module-providers/Qt/setup-qt.js
+++ share/qbs/module-providers/Qt/setup-qt.js
@@ -53,24 +53,30 @@
     if (qmakeFilePaths && qmakeFilePaths.length > 0)
         return qmakeFilePaths;
     console.info("Detecting Qt installations...");
-    var pathValue = Environment.getEnv("PATH");
-    if (!pathValue)
-        return [];
-    var dirs = splitNonEmpty(pathValue, qbs.pathListSeparator);
-    var suffix = exeSuffix(qbs);
     var filePaths = [];
-    for (var i = 0; i < dirs.length; ++i) {
-        var candidate = FileInfo.joinPaths(dirs[i], "qmake" + suffix);
-        var canonicalCandidate = FileInfo.canonicalPath(candidate);
-        if (!canonicalCandidate || !File.exists(canonicalCandidate))
-            continue;
-        if (FileInfo.completeBaseName(canonicalCandidate) !== "qtchooser")
-            candidate = canonicalCandidate;
-        if (!filePaths.contains(candidate)) {
-            console.info("Found Qt at '" + toNative(candidate) + "'.");
-            filePaths.push(candidate);
+    var pathValue = Environment.getEnv("PATH");
+    if (pathValue) {
+        var dirs = splitNonEmpty(pathValue, qbs.pathListSeparator);
+        var versions = ["", "-qt5", "-qt4"];
+        var suffix = exeSuffix(qbs);
+        for (var i = 0; i < dirs.length; ++i) { for (var iver = 0; iver < versions.length; ++iver) {
+            var candidate = FileInfo.joinPaths(dirs[i], "qmake" + versions[iver] + suffix);
+            var canonicalCandidate = FileInfo.canonicalPath(candidate);
+            if (!canonicalCandidate || !File.exists(canonicalCandidate))
+                continue;
+            if (FileInfo.completeBaseName(canonicalCandidate) !== "qtchooser")
+                candidate = canonicalCandidate;
+            if (!filePaths.contains(candidate)) {
+                console.info("Found Qt at '" + toNative(candidate) + "'.");
+                filePaths.push(candidate);
+            } }
         }
     }
+    if (filePaths.length === 0) {
+        console.warn("Could not find any qmake executables in PATH. Either make sure a qmake "
+        + "executable is present in PATH or set the moduleProviders.Qt.qmakeFilePaths property "
+        + "to point a qmake executable.");
+    }
     return filePaths;
 }