summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorEric Lemanissier <eric.lemanissier@gmail.com>2015-03-04 12:58:28 +0100
committerEric Lemanissier <eric.lemanissier@gmail.com>2015-03-25 11:13:19 +0000
commitb814d05101bbc35354388d5e46bd13df9e4a663e (patch)
tree42d10929c7962772d564f713dbdc03d9d9acd8a3 /tools
parentb0c58c2bb4cde616302f98e4c64549ae2ae028cf (diff)
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>
Diffstat (limited to 'tools')
-rw-r--r--tools/configure/configureapp.cpp14
-rw-r--r--tools/configure/environment.cpp12
-rw-r--r--tools/configure/environment.h1
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);