QbsProjectManager: Write MSVC compiler version to profile

Change-Id: Ibd8c559ffecf327eee6af8e6d5fbacb5c8c863d1
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
Joerg Bornemann
2016-05-17 14:40:46 +02:00
committed by Jake Petroules
parent e9e47ab452
commit 3c63b621d9
2 changed files with 22 additions and 2 deletions

View File

@@ -156,6 +156,19 @@ QVariantMap DefaultPropertyProvider::properties(const ProjectExplorer::Kit *k,
return data;
}
struct MSVCVersion
{
int major = 0;
int minor = 0;
};
static MSVCVersion msvcCompilerVersion(const ProjectExplorer::Abi &abi)
{
MSVCVersion v;
v.major = abi.osFlavor() - ProjectExplorer::Abi::WindowsMsvc2005Flavor + 14;
return v;
}
QVariantMap DefaultPropertyProvider::autoGeneratedProperties(const ProjectExplorer::Kit *k,
const QVariantMap &defaultData) const
{
@@ -228,10 +241,14 @@ QVariantMap DefaultPropertyProvider::autoGeneratedProperties(const ProjectExplor
const QString toolchainPrefix = extractToolchainPrefix(&compilerName);
if (!toolchainPrefix.isEmpty())
data.insert(QLatin1String(CPP_TOOLCHAINPREFIX), toolchainPrefix);
if (toolchain.contains(QLatin1String("msvc")))
if (toolchain.contains(QLatin1String("msvc"))) {
data.insert(QLatin1String(CPP_COMPILERNAME), compilerName);
else
const MSVCVersion v = msvcCompilerVersion(targetAbi);
data.insert(QLatin1String(CPP_COMPILERVERSIONMAJOR), v.major);
data.insert(QLatin1String(CPP_COMPILERVERSIONMINOR), v.minor);
} else {
data.insert(QLatin1String(CPP_CXXCOMPILERNAME), compilerName);
}
if (targetAbi.os() != ProjectExplorer::Abi::WindowsOS
|| targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMSysFlavor) {
data.insert(QLatin1String(CPP_LINKERNAME), compilerName);

View File

@@ -38,6 +38,9 @@ const char CPP_TOOLCHAINPATH[] = "cpp.toolchainInstallPath";
const char CPP_TOOLCHAINPREFIX[] = "cpp.toolchainPrefix";
const char CPP_COMPILERNAME[] = "cpp.compilerName";
const char CPP_CXXCOMPILERNAME[] = "cpp.cxxCompilerName";
const char CPP_COMPILERVERSIONMAJOR[] = "cpp.compilerVersionMajor";
const char CPP_COMPILERVERSIONMINOR[] = "cpp.compilerVersionMinor";
const char CPP_COMPILERVERSIONPATCH[] = "cpp.compilerVersionPatch";
const char CPP_LINKERNAME[] = "cpp.linkerName";
const char CPP_PLATFORMCFLAGS[] = "cpp.platformCFlags";
const char CPP_PLATFORMCXXFLAGS[] = "cpp.platformCxxFlags";