Add mingw GCC Version to qconfig.pri
This change adds missing variables in mkspecs/qconfig.pri about gcc compiler version when using mingw: QT_GCC_{MAJOR,MINOR,PATCH}_VERSION This is needed in case CONFIG += c++14 is used. Task-number: QTBUG-44142 Change-Id: I34c27f9154bb745a8ee75c777a0acbdbc5bda5a9 Reviewed-by: Louai Al-Khanji <louai.al-khanji@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This commit is contained in:
parent
b0c58c2bb4
commit
b814d05101
@ -305,6 +305,14 @@ Configure::Configure(int& argc, char** argv)
|
||||
dictionary[ "LTCG" ] = "no";
|
||||
dictionary[ "NATIVE_GESTURES" ] = "yes";
|
||||
dictionary[ "MSVC_MP" ] = "no";
|
||||
|
||||
if (dictionary["QMAKESPEC"] == QString("win32-g++")) {
|
||||
const QString zero = QStringLiteral("0");
|
||||
const QStringList parts = Environment::gccVersion().split(QLatin1Char('.'));
|
||||
dictionary["QT_GCC_MAJOR_VERSION"] = parts.value(0, zero);
|
||||
dictionary["QT_GCC_MINOR_VERSION"] = parts.value(1, zero);
|
||||
dictionary["QT_GCC_PATCH_VERSION"] = parts.value(2, zero);
|
||||
}
|
||||
}
|
||||
|
||||
Configure::~Configure()
|
||||
@ -3466,6 +3474,12 @@ void Configure::generateQConfigPri()
|
||||
if (dictionary[ "SHARED" ] == "no")
|
||||
configStream << "QT_DEFAULT_QPA_PLUGIN = q" << qpaPlatformName() << endl;
|
||||
|
||||
if (!dictionary["QT_GCC_MAJOR_VERSION"].isEmpty()) {
|
||||
configStream << "QT_GCC_MAJOR_VERSION = " << dictionary["QT_GCC_MAJOR_VERSION"] << endl
|
||||
<< "QT_GCC_MINOR_VERSION = " << dictionary["QT_GCC_MINOR_VERSION"] << endl
|
||||
<< "QT_GCC_PATCH_VERSION = " << dictionary["QT_GCC_PATCH_VERSION"] << endl;
|
||||
}
|
||||
|
||||
if (!configStream.flush())
|
||||
dictionary[ "DONE" ] = "error";
|
||||
}
|
||||
|
@ -163,6 +163,18 @@ Compiler Environment::compilerFromQMakeSpec(const QString &qmakeSpec)
|
||||
return CC_UNKNOWN;
|
||||
}
|
||||
|
||||
QString Environment::gccVersion()
|
||||
{
|
||||
CompilerInfo *info = compilerInfo(CC_MINGW);
|
||||
int returnValue = 0;
|
||||
QString version = execute(QStringLiteral("%1 -dumpversion").arg(info->executable), &returnValue);
|
||||
if (returnValue != 0) {
|
||||
cout << "Could not get mingw version" << returnValue << qPrintable(version);
|
||||
version.resize(0);
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the enum of the compiler which was detected on the system.
|
||||
The compilers are detected in the order as entered into the
|
||||
|
@ -56,6 +56,7 @@ public:
|
||||
static Compiler detectCompiler();
|
||||
static QString detectQMakeSpec();
|
||||
static Compiler compilerFromQMakeSpec(const QString &qmakeSpec);
|
||||
static QString gccVersion();
|
||||
|
||||
static int execute(QStringList arguments, const QStringList &additionalEnv, const QStringList &removeEnv);
|
||||
static QString execute(const QString &command, int *returnCode = 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user