From 81ce096719858512ab3dffd7f65c7ad75fe42ea6 Mon Sep 17 00:00:00 2001 From: Ivan Donchevskii Date: Mon, 7 Jan 2019 15:54:17 +0100 Subject: [PATCH] ProjectExplorer: Split sysroot and target flags Whitelist target even if we have the sysroot set in the kit. Change-Id: Ie51c0b25255e23458321303fc80ee9cf91879ab1 Reviewed-by: Christian Kandeler --- src/plugins/projectexplorer/gcctoolchain.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index b834a5809b9..ab5bbdaf82c 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -546,15 +546,19 @@ QStringList GccToolChain::gccPrepareArguments(const QStringList &flags, for (int i = 0; i < allFlags.size(); ++i) { const QString &flag = allFlags.at(i); if (flag.startsWith("-stdlib=") || flag.startsWith("--gcc-toolchain=") - || flag.startsWith("-B") || (flag.startsWith("-isystem") && flag.length() > 8)) { + || flag.startsWith("-B") || flag.startsWith("--target=") + || (flag.startsWith("-isystem") && flag.length() > 8)) { arguments << flag; + } else if ((flag == "-target" || flag == "-gcc-toolchain" || flag == "-isystem") + && i < flags.size() - 1) { + arguments << flag << allFlags.at(i + 1); + ++i; } else if (!hasKitSysroot) { // pass build system's sysroot to compiler, if we didn't pass one from kit - if (flag.startsWith("--sysroot=")) { + if (flag.startsWith("--sysroot=") + || (flag.startsWith("-isysroot") && flag.length() > 9)) { arguments << flag; - } else if ((flag.startsWith("-isysroot") || flag.startsWith("--sysroot") - || flag == "-target" || flag == "-gcc-toolchain" || flag == "-isystem") - && i < flags.size() - 1) { + } else if (flag == "-isysroot" && i < flags.size() - 1) { arguments << flag << allFlags.at(i + 1); ++i; }