aboutsummaryrefslogtreecommitdiffstats
path: root/share/qbs/modules/cpp/msvc.js
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@petroules.com>2013-04-12 01:40:49 -0400
committerJoerg Bornemann <joerg.bornemann@digia.com>2013-04-12 15:04:09 +0200
commit88fdf28c0d499f6dea6193072e796c313e61c2b3 (patch)
tree50ed1a0559cd666fa4819337882ff9832ca3f339 /share/qbs/modules/cpp/msvc.js
parented53341676e8902600e6ef95936d6cfdab6087d9 (diff)
Fix handling of minimum Windows version and subsystem linker flags.
Both MSVC and MinGW now only pass their respective subsystem flags if product.consoleApplication is not undefined - the linkers use console by default. MSVC: as an exception to the above, a subsystem flag must be passed regardless of the value of product.consoleApplication if a minimum system version was specified - in this case subsystem will be set to console. MinGW now correctly handles setting the minimum subsystem/OS version; it was previously using totally nonexistent flags due to poor assumptions about its MSVC compatibility. The test case which tests this functionality was also broken, and is now fixed as well. Task-number: QBS-244 Change-Id: Ibca29ce673a81f1231d364d5b6e6875a462b379c Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'share/qbs/modules/cpp/msvc.js')
-rw-r--r--share/qbs/modules/cpp/msvc.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/share/qbs/modules/cpp/msvc.js b/share/qbs/modules/cpp/msvc.js
index 257705b32..ed8af567b 100644
--- a/share/qbs/modules/cpp/msvc.js
+++ b/share/qbs/modules/cpp/msvc.js
@@ -121,20 +121,27 @@ function prepareLinker(product, inputs, outputs, libraryPaths, dynamicLibraries,
else
args.push('/INCREMENTAL:NO')
- var subsystemSwitch = product.consoleApplication ? '/SUBSYSTEM:CONSOLE' : '/SUBSYSTEM:WINDOWS';
-
var minimumWindowsVersion = ModUtils.moduleProperty(product, "minimumWindowsVersion");
+ var subsystemSwitch = undefined;
+ if (minimumWindowsVersion || product.consoleApplication !== undefined) {
+ // Ensure that we default to console if product.consoleApplication is undefined
+ // since that could still be the case if only minimumWindowsVersion had been defined
+ subsystemSwitch = product.consoleApplication === false ? '/SUBSYSTEM:WINDOWS' : '/SUBSYSTEM:CONSOLE';
+ }
+
if (minimumWindowsVersion) {
var subsystemVersion = Windows.getWindowsVersionInFormat(minimumWindowsVersion, 'subsystem');
if (subsystemVersion) {
- args.push(subsystemSwitch + ',' + subsystemVersion);
+ subsystemSwitch += ',' + subsystemVersion;
args.push('/OSVERSION:' + subsystemVersion);
} else {
print('WARNING: Unknown Windows version "' + minimumWindowsVersion + '"');
- args.push(subsystemSwitch);
}
}
+ if (subsystemSwitch)
+ args.push(subsystemSwitch);
+
var linkerOutputNativeFilePath;
var manifestFileName;
if (generateManifestFiles) {