summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2021-04-23 15:42:15 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2021-04-27 15:12:39 +0200
commitaa09c472d441a39bdf16e6d89fb700d04cf3e967 (patch)
tree6da3032738ff572f645c0ca6ab52261fa2545a42 /qmake
parentb9cea5d0c02579fd7224deec04088fe5cbee2da9 (diff)
Fix "qmake -spec foo" call for cross builds
In a cross built Qt, for example Qt for Android, calling "qmake -spec android-clang" led to an error message: "Could not find qmake spec '-qtconf'." This happened, because: - the qmake in Qt for Android is a wrapper script that calls "qmake -qtconf qt_target.conf -spec android-clang" - the first stage of command line argument handling in qmake garbled the call to "qmake -spec -qtconf qt_target.conf android-clang" We do not modify the order of arguments anymore. Instead, we skip the "-qtconf <file>" arguments in the first argument handling stage that is supposed to determine qmake's modus operandi (like -project or -query). This amends commit 661b586a69740bd9a1791622f8b238d290ebe00d. Fixes: QTBUG-93079 Task-number: QTBUG-85136 Change-Id: I12ec25b17d64c00be2a3904b7c4a975b781500a0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 63a812b85191c9cfe0704d400df86ce7961dea12)
Diffstat (limited to 'qmake')
-rw-r--r--qmake/option.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/qmake/option.cpp b/qmake/option.cpp
index 88b018eb97..6a976a3ebc 100644
--- a/qmake/option.cpp
+++ b/qmake/option.cpp
@@ -403,8 +403,9 @@ Option::init(int argc, char **argv)
for (int i = 1; i < argc; i++)
args << QString::fromLocal8Bit(argv[i]);
- while (!args.isEmpty()) {
- QString opt = args.at(0);
+ qsizetype idx = 0;
+ while (idx < args.size()) {
+ QString opt = args.at(idx);
if (opt == "-project") {
Option::recursive = true;
Option::qmake_mode = Option::QMAKE_GENERATE_PROJECT;
@@ -421,15 +422,15 @@ Option::init(int argc, char **argv)
} else if (opt == "-makefile") {
Option::qmake_mode = Option::QMAKE_GENERATE_MAKEFILE;
} else if (opt == "-qtconf") {
- if (args.length() >= 3) {
- // Move the argument following "-qtconf <file>" in front and check again.
- args.prepend(args.takeAt(2));
- continue;
- }
+ // Skip "-qtconf <file>" and proceed.
+ ++idx;
+ if (idx + 1 < args.length())
+ ++idx;
+ continue;
} else {
break;
}
- args.takeFirst();
+ args.takeAt(idx);
break;
}