qmake vcproj generator: Honor the preferred MSVC version in the mkspec

Some cross-compiling mkspecs may require a different MSVC version than
the one found in the path (or the default version). This change allows
the preferred MSVC version to be selected from the mkspec's MSVC_VER
variable when found.

Task-number: QTBUG-35328
Change-Id: I19e03101e3921dfd5026421aef4630e11b9f131e
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
Andrew Knight 2013-12-26 16:04:29 +02:00 committed by The Qt Project
parent a90972e8f8
commit 503fd267da

View File

@ -111,9 +111,10 @@ QT_END_NAMESPACE
#endif
QT_BEGIN_NAMESPACE
DotNET which_dotnet_version()
DotNET which_dotnet_version(const QByteArray &preferredVersion = QByteArray())
{
#ifndef Q_OS_WIN32
Q_UNUSED(preferredVersion);
return NET2002; // Always generate 7.0 versions on other platforms
#else
// Only search for the version once
@ -135,6 +136,10 @@ DotNET which_dotnet_version()
installPaths.insert(lowestInstalledVersion->version, path);
++installed;
current_version = lowestInstalledVersion->version;
if (QByteArray(lowestInstalledVersion->versionStr).contains(preferredVersion)) {
installed = 1;
break;
}
}
}
@ -583,7 +588,7 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
return;
}
switch(which_dotnet_version()) {
switch (which_dotnet_version(project->first("MSVC_VER").toLatin1())) {
case NET2013:
t << _slnHeader120;
break;
@ -872,7 +877,7 @@ void VcprojGenerator::initProject()
// Own elements -----------------------------
vcProject.Name = unescapeFilePath(project->first("QMAKE_ORIG_TARGET").toQString());
switch(which_dotnet_version()) {
switch (which_dotnet_version(project->first("MSVC_VER").toLatin1())) {
case NET2013:
vcProject.Version = "13.00";
break;
@ -922,7 +927,7 @@ void VcprojGenerator::initConfiguration()
// - Do this first since main configuration elements may need
// - to know of certain compiler/linker options
VCConfiguration &conf = vcProject.Configuration;
conf.CompilerVersion = which_dotnet_version();
conf.CompilerVersion = which_dotnet_version(project->first("MSVC_VER").toLatin1());
initCompilerTool();