diff options
-rw-r--r-- | tools/configure/configureapp.cpp | 14 | ||||
-rw-r--r-- | tools/configure/environment.cpp | 12 | ||||
-rw-r--r-- | tools/configure/environment.h | 1 |
3 files changed, 27 insertions, 0 deletions
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 4f78660db4..8544e13ed0 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -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"; } diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp index c08595e36b..63c1e8a1f0 100644 --- a/tools/configure/environment.cpp +++ b/tools/configure/environment.cpp @@ -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 diff --git a/tools/configure/environment.h b/tools/configure/environment.h index 669c356f34..927c3e294f 100644 --- a/tools/configure/environment.h +++ b/tools/configure/environment.h @@ -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); |