summaryrefslogtreecommitdiffstats
path: root/qmake/generators
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2018-02-19 12:18:57 +0100
committerJoerg Bornemann <joerg.bornemann@qt.io>2018-04-06 06:18:00 +0000
commit0ee5cbb1a449e05270454dfb6151438b04a5cb84 (patch)
tree203f0c428b815e93b65aadb609489ffb2bc6ccd0 /qmake/generators
parentb32d16d468db81a1ba1049cad2d336e2ce8d7472 (diff)
Set WindowsTargetPlatform[Min]Version if WindowsSDKVersion is set
This fixes qmake-generated project files for Visual Studio 2017 for setups where the Windows 8.1 SDK is not installed. Task-number: QTBUG-66265 Change-Id: I67712019f7142e40262f171eb23f9f1e6ab3a251 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Miguel Costa <miguel.costa@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'qmake/generators')
-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();