aboutsummaryrefslogtreecommitdiffstats
path: root/src/app/qbs-setup-qt/setupqt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/qbs-setup-qt/setupqt.cpp')
-rw-r--r--src/app/qbs-setup-qt/setupqt.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/app/qbs-setup-qt/setupqt.cpp b/src/app/qbs-setup-qt/setupqt.cpp
index b7334afa7..9314c69aa 100644
--- a/src/app/qbs-setup-qt/setupqt.cpp
+++ b/src/app/qbs-setup-qt/setupqt.cpp
@@ -411,38 +411,38 @@ static bool isMsvcQt(const QtEnvironment &env)
return env.mkspecName.startsWith(msvcPrefix);
}
-static int msvcCompilerMajorVersionForYear(int year)
+static Version msvcCompilerVersionForYear(int year)
{
switch (year)
{
case 2005:
- return 14;
+ return Version(14);
case 2008:
- return 15;
+ return Version(15);
case 2010:
- return 16;
+ return Version(16);
case 2012:
- return 17;
+ return Version(17);
case 2013:
- return 18;
+ return Version(18);
case 2015:
- return 19;
+ return Version(19);
default:
- return 0;
+ return Version();
}
}
-static int msvcCompilerMajorVersionForYear(const QtEnvironment &env)
+static Version msvcCompilerVersionForYear(const QtEnvironment &env)
{
return isMsvcQt(env)
- ? msvcCompilerMajorVersionForYear(env.mkspecName.mid(msvcPrefix.size()).toInt())
- : 0;
+ ? msvcCompilerVersionForYear(env.mkspecName.mid(msvcPrefix.size()).toInt())
+ : Version();
}
enum Match { MatchFull, MatchPartial, MatchNone };
static Match compatibility(const QtEnvironment &env, const Profile &toolchainProfile,
- int msvcCompilerVersionMajor)
+ const Version &msvcCompilerVersion)
{
Match match = MatchFull;
@@ -470,11 +470,11 @@ static Match compatibility(const QtEnvironment &env, const Profile &toolchainPro
canonicalArchitecture(toolchainArchitecture)))
return MatchNone;
- if (msvcCompilerVersionMajor) {
+ if (msvcCompilerVersion.isValid()) {
// We want to know for sure that MSVC compiler versions match,
// because it's especially important for this toolchain
- if (msvcCompilerVersionMajor == 0 || msvcCompilerVersionMajor !=
- toolchainProfile.value(QLatin1String("cpp.compilerVersionMajor"))) {
+ if (msvcCompilerVersion != Version::fromString(
+ toolchainProfile.value(QLatin1String("cpp.compilerVersion")).toString())) {
return MatchNone;
}
}
@@ -519,7 +519,7 @@ void SetupQt::saveToQbsSettings(const QString &qtVersionName, const QtEnvironmen
QStringList fullMatches;
QStringList partialMatches;
- const int msvcCompilerVersionMajor = msvcCompilerMajorVersionForYear(qtEnvironment);
+ const Version msvcCompilerVersion = msvcCompilerVersionForYear(qtEnvironment);
foreach (const QString &profileName, settings->profiles()) {
const Profile otherProfile(profileName, settings);
if (profileName == profile.name()
@@ -527,7 +527,7 @@ void SetupQt::saveToQbsSettings(const QString &qtVersionName, const QtEnvironmen
|| isQtProfile(otherProfile))
continue;
- switch (compatibility(qtEnvironment, otherProfile, msvcCompilerVersionMajor)) {
+ switch (compatibility(qtEnvironment, otherProfile, msvcCompilerVersion)) {
case MatchFull:
fullMatches << profileName;
break;
@@ -539,7 +539,7 @@ void SetupQt::saveToQbsSettings(const QString &qtVersionName, const QtEnvironmen
}
}
- if (msvcCompilerVersionMajor && fullMatches.size() > 1)
+ if (msvcCompilerVersion.isValid() && fullMatches.size() > 1)
compressMsvcProfiles(fullMatches);
QString bestMatch;