diff options
author | Alberto Mardegan <mardy@users.sourceforge.net> | 2020-04-12 10:11:47 +0300 |
---|---|---|
committer | Alberto Mardegan <mardy@users.sourceforge.net> | 2020-04-15 16:07:54 +0000 |
commit | 846fc574f38395af24a9e60726372cb56075cff4 (patch) | |
tree | 51cbad18794986afd53b06fa4cda4da45f7aaad9 /src | |
parent | 8ceb1028659f9f5f921195192cafef9791f29682 (diff) | |
download | qbs-846fc574f38395af24a9e60726372cb56075cff4.tar.gz |
GCC: fix detection of Mingw prefix in MXE
The toolchain paths in MXE are of the form
$MXE_PATH/usr/bin/x86_64-w64-mingw32.shared-g++
so we should not assume that what follows the dot is an extension that
needs to be stripped (like QFileInfo::completeBaseName() does). Instead,
only strip the know executable extensions.
Change-Id: I51040d65e372ef3152ddd9229dd33011661c2b46
Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Richard Weickelt <richard@weickelt.de>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Diffstat (limited to 'src')
-rw-r--r-- | src/app/qbs-setup-toolchains/gccprobe.cpp | 2 | ||||
-rw-r--r-- | src/lib/corelib/tools/hostosinfo.h | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/app/qbs-setup-toolchains/gccprobe.cpp b/src/app/qbs-setup-toolchains/gccprobe.cpp index df3f92f62..6cbe246a5 100644 --- a/src/app/qbs-setup-toolchains/gccprobe.cpp +++ b/src/app/qbs-setup-toolchains/gccprobe.cpp @@ -111,7 +111,7 @@ class ToolchainDetails public: explicit ToolchainDetails(const QFileInfo &compiler) { - auto baseName = compiler.completeBaseName(); + auto baseName = HostOsInfo::stripExecutableSuffix(compiler.fileName()); // Extract the version sub-string if it exists. We assume that a version // sub-string located after the compiler prefix && suffix. E.g. this code // parses a version from the compiler names, like this: diff --git a/src/lib/corelib/tools/hostosinfo.h b/src/lib/corelib/tools/hostosinfo.h index 42ce3f8cf..0876d39ec 100644 --- a/src/lib/corelib/tools/hostosinfo.h +++ b/src/lib/corelib/tools/hostosinfo.h @@ -112,6 +112,13 @@ public: return finalName; } + static QString stripExecutableSuffix(const QString &executable) + { + constexpr QLatin1String suffix(QBS_HOST_EXE_SUFFIX, sizeof(QBS_HOST_EXE_SUFFIX) - 1); + return !suffix.isEmpty() && executable.endsWith(suffix) + ? executable.chopped(suffix.size()) : executable; + } + static QString dynamicLibraryName(const QString &libraryBaseName) { return QLatin1String(QBS_HOST_DYNAMICLIB_PREFIX) + libraryBaseName |