diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp index 51cb73f0ce..feef587ee6 100644 --- a/qmake/generators/win32/msbuild_objectmodel.cpp +++ b/qmake/generators/win32/msbuild_objectmodel.cpp @@ -1779,8 +1779,7 @@ void VCXProjectWriter::write(XmlOutput &xml, const VCConfiguration &tool) xml << tag("PropertyGroup") << attrTag("Condition", generateCondition(tool)) << attrTag("Label", "Configuration") - << attrTagS(_PlatformToolSet, platformToolSetVersion(tool.CompilerVersion, - tool.WinPhone)) + << attrTagS(_PlatformToolSet, tool.PlatformToolSet) << attrTagS(_OutputDirectory, tool.OutputDirectory) << attrTagT(_ATLMinimizesCRunTimeLibraryUsage, tool.ATLMinimizesCRunTimeLibraryUsage) << attrTagT(_BuildBrowserInformation, tool.BuildBrowserInformation) @@ -2193,27 +2192,4 @@ QString VCXProjectWriter::generateCondition(const VCConfiguration &config) return QStringLiteral("'$(Configuration)|$(Platform)'=='") + config.Name + QLatin1Char('\''); } -QString VCXProjectWriter::platformToolSetVersion(const DotNET version, bool winphoneBuild) -{ - // The PlatformToolset string corresponds to the name of a directory in - // $(VCTargetsPath)\Platforms\{Win32,x64,...}\PlatformToolsets - // e.g. v90, v100, v110, v110_xp, v120_CTP_Nov, v120, or WindowsSDK7.1 - - // This environment variable may be set by a commandline build - // environment such as the Windows SDK command prompt - QByteArray envVar = qgetenv("PlatformToolset"); - if (!envVar.isEmpty()) - return envVar; - - switch (version) - { - case NET2012: - return winphoneBuild ? "v110_wp80" : "v110"; - case NET2013: - return "v120"; - default: - return QString(); - } -} - QT_END_NAMESPACE diff --git a/qmake/generators/win32/msbuild_objectmodel.h b/qmake/generators/win32/msbuild_objectmodel.h index 2f02e66eb9..8ccb4b8859 100644 --- a/qmake/generators/win32/msbuild_objectmodel.h +++ b/qmake/generators/win32/msbuild_objectmodel.h @@ -184,7 +184,6 @@ private: static void outputFileConfigs(VCProject &project, XmlOutput &xml, XmlOutput &xmlFilter, const VCFilterFile &info, const QString &filtername); static bool outputFileConfig(VCFilter &filter, XmlOutput &xml, XmlOutput &xmlFilter, const QString &filename, const QString &filtername, bool fileAllreadyAdded); static QString generateCondition(const VCConfiguration &config); - static QString platformToolSetVersion(const DotNET version, bool winphoneBuild); friend class XTreeNode; friend class XFlatNode; diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h index 0aa5736d2a..ac96d55de1 100644 --- a/qmake/generators/win32/msvc_objectmodel.h +++ b/qmake/generators/win32/msvc_objectmodel.h @@ -901,6 +901,7 @@ public: QString OutputDirectory; QString PrimaryOutput; QString ProgramDatabase; + QString PlatformToolSet; triState RegisterOutput; useOfATL UseOfATL; useOfMfc UseOfMfc; diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index ce9dc6d9ec..86a9d518f2 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -384,6 +384,29 @@ QUuid VcprojGenerator::increaseUUID(const QUuid &id) return result; } +QString VcprojGenerator::retrievePlatformToolSet() const +{ + // The PlatformToolset string corresponds to the name of a directory in + // $(VCTargetsPath)\Platforms\{Win32,x64,...}\PlatformToolsets + // e.g. v90, v100, v110, v110_xp, v120_CTP_Nov, v120, or WindowsSDK7.1 + + // This environment variable may be set by a commandline build + // environment such as the Windows SDK command prompt + QByteArray envVar = qgetenv("PlatformToolset"); + if (!envVar.isEmpty()) + return envVar; + + switch (vcProject.Configuration.CompilerVersion) + { + case NET2012: + return vcProject.Configuration.WinPhone ? "v110_wp80" : "v110"; + case NET2013: + return "v120"; + default: + return QString(); + } +} + ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash &projLookup, QHash &projGuids, QHash &extraSubdirs, @@ -969,6 +992,8 @@ void VcprojGenerator::initConfiguration() if (!conf.OutputDirectory.endsWith("\\")) conf.OutputDirectory += '\\'; if (conf.CompilerVersion >= NET2010) { + conf.PlatformToolSet = retrievePlatformToolSet(); + // The target name could have been changed. conf.PrimaryOutput = project->first("TARGET").toQString(); if ( !conf.PrimaryOutput.isEmpty() && !project->first("TARGET_VERSION_EXT").isEmpty() && project->isActiveConfig("shared")) diff --git a/qmake/generators/win32/msvc_vcproj.h b/qmake/generators/win32/msvc_vcproj.h index 4a25d11766..7dcd9f72df 100644 --- a/qmake/generators/win32/msvc_vcproj.h +++ b/qmake/generators/win32/msvc_vcproj.h @@ -144,6 +144,7 @@ private: QHash &subdirProjectLookup, const ProStringList &allDependencies = ProStringList()); QUuid increaseUUID(const QUuid &id); + QString retrievePlatformToolSet() const; friend class VCFilter; };