summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
Diffstat (limited to 'qmake')
-rw-r--r--qmake/generators/win32/msbuild_objectmodel.cpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp
index 38bf3a0cbd..9f82ce4f8e 100644
--- a/qmake/generators/win32/msbuild_objectmodel.cpp
+++ b/qmake/generators/win32/msbuild_objectmodel.cpp
@@ -34,6 +34,7 @@
#include <qscopedpointer.h>
#include <qstringlist.h>
#include <qfileinfo.h>
+#include <qversionnumber.h>
QT_BEGIN_NAMESPACE
@@ -618,17 +619,30 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
<< tagValue("RootNamespace", tool.Name)
<< tagValue("Keyword", tool.Keyword);
+ QString windowsTargetPlatformVersion;
if (isWinRT) {
xml << tagValue("MinimumVisualStudioVersion", tool.Version)
<< tagValue("DefaultLanguage", "en")
<< tagValue("AppContainerApplication", "true")
<< tagValue("ApplicationType", "Windows Store")
<< tagValue("ApplicationTypeRevision", tool.SdkVersion);
- if (tool.SdkVersion == "10.0") {
- const QString ucrtVersion = qgetenv("UCRTVERSION");
- xml << tagValue("WindowsTargetPlatformVersion", ucrtVersion)
- << tagValue("WindowsTargetPlatformMinVersion", ucrtVersion);
- }
+ if (tool.SdkVersion == "10.0")
+ windowsTargetPlatformVersion = qgetenv("UCRTVERSION");
+ } else {
+ QByteArray winSDKVersionStr = qgetenv("WindowsSDKVersion").trimmed();
+
+ // This environment variable might end with a backslash due to a VS bug.
+ if (winSDKVersionStr.endsWith('\\'))
+ winSDKVersionStr.chop(1);
+
+ QVersionNumber winSDKVersion = QVersionNumber::fromString(
+ QString::fromLocal8Bit(winSDKVersionStr));
+ if (!winSDKVersion.isNull())
+ windowsTargetPlatformVersion = winSDKVersionStr;
+ }
+ if (!windowsTargetPlatformVersion.isEmpty()) {
+ xml << tagValue("WindowsTargetPlatformVersion", windowsTargetPlatformVersion)
+ << tagValue("WindowsTargetPlatformMinVersion", windowsTargetPlatformVersion);
}
xml << closetag();