McuSupport: Fix version detection for GHS toolchains

The GHS compiler invoked without a valid input source file returns
an error code. Use gversion instead, a utility part of the toolchain,
with -help to retrieve the version string.

Change-Id: I289f462d322db045368cfb5a02b6644838559639
Reviewed-by: Sivert Krøvel <sivert.krovel@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Daniele Bortolotti
2022-10-27 13:57:54 +02:00
parent db7674307d
commit afb3c09289

View File

@@ -276,8 +276,8 @@ McuToolChainPackagePtr createGhsToolchainPackage(const SettingsHandler::Ptr &set
const FilePath defaultPath = FilePath::fromUserInput(qtcEnvironmentVariable(envVar));
const auto *versionDetector
= new McuPackageExecutableVersionDetector(FilePath("as850").withExecutableSuffix(),
{"-V"},
= new McuPackageExecutableVersionDetector(FilePath("gversion").withExecutableSuffix(),
{"-help"},
R"(\bv(\d+\.\d+\.\d+)\b)");
return McuToolChainPackagePtr{
@@ -301,8 +301,8 @@ McuToolChainPackagePtr createGhsArmToolchainPackage(const SettingsHandler::Ptr &
const FilePath defaultPath = FilePath::fromUserInput(qtcEnvironmentVariable(envVar));
const auto *versionDetector
= new McuPackageExecutableVersionDetector(FilePath("asarm").withExecutableSuffix(),
{"-V"},
= new McuPackageExecutableVersionDetector(FilePath("gversion").withExecutableSuffix(),
{"-help"},
R"(\bv(\d+\.\d+\.\d+)\b)");
return McuToolChainPackagePtr{