diff options
| author | Joerg Bornemann <joerg.bornemann@theqtcompany.com> | 2014-10-29 13:31:52 +0100 |
|---|---|---|
| committer | Joerg Bornemann <joerg.bornemann@theqtcompany.com> | 2014-10-29 14:40:23 +0100 |
| commit | 29a977873bc2d8d46926de5f60d1e78da82fde74 (patch) | |
| tree | 2b89b03285852cc26a67a785b979f1298955506d | |
| parent | eda76354077a427d692fee05479910de31040d3f (diff) | |
| download | qbs-29a977873bc2d8d46926de5f60d1e78da82fde74.tar.gz | |
introduce cpp.runtimeLibrary
This property determines the type of the used runtime library.
Accepted values are \c{"static"} and \c{"dynamic"}.
If this property is set to \c{undefined}, then the default runtime
library of the toolchain is used.
For MSVC the default value is "dynamic".
At the moment this property is only functional for MSVC.
Support for other toolchains may be added later.
Change-Id: I6795e89280d057cdb31967ef5c114ef60b3a98be
Task-number: QBS-570
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
| -rw-r--r-- | doc/reference/modules/cpp-module.qdoc | 13 | ||||
| -rw-r--r-- | share/qbs/modules/cpp/CppModule.qbs | 7 | ||||
| -rw-r--r-- | share/qbs/modules/cpp/msvc.js | 14 | ||||
| -rw-r--r-- | share/qbs/modules/cpp/windows-msvc.qbs | 1 |
4 files changed, 31 insertions, 4 deletions
diff --git a/doc/reference/modules/cpp-module.qdoc b/doc/reference/modules/cpp-module.qdoc index 9d4781fb3..5eaab9102 100644 --- a/doc/reference/modules/cpp-module.qdoc +++ b/doc/reference/modules/cpp-module.qdoc @@ -404,6 +404,19 @@ Name of the entry point of an executable or dynamic library. If this property is undefined, the toolchain's default is used. + \section2 runtimeLibrary + + \table + \row \li \b{Type:} \li \c{string} + \row \li \b{Default:} \li \c{"dynamic"} for MSVC, \c{undefined} for others + \endtable + + Type of the used runtime library. Accepted values are \c{"static"} and \c{"dynamic"}. + If this property is set to \c{undefined}, then the default runtime library of the toolchain + is used. + \note For MSVC the default value is \c{"dynamic"}. + \note At the moment this property is only functional for MSVC. + \section1 Properties Specific to iOS and OS X diff --git a/share/qbs/modules/cpp/CppModule.qbs b/share/qbs/modules/cpp/CppModule.qbs index 298c1b803..1f659b64f 100644 --- a/share/qbs/modules/cpp/CppModule.qbs +++ b/share/qbs/modules/cpp/CppModule.qbs @@ -157,6 +157,13 @@ Module { description: "entry point symbol for an executable or dynamic library" } + property string runtimeLibrary + PropertyOptions { + name: "runtimeLibrary" + description: "determine which runtime library to use" + allowedValues: ['static', 'dynamic'] + } + property string visibility: 'default' PropertyOptions { name: "visibility" diff --git a/share/qbs/modules/cpp/msvc.js b/share/qbs/modules/cpp/msvc.js index 980239e5f..9961ab5ce 100644 --- a/share/qbs/modules/cpp/msvc.js +++ b/share/qbs/modules/cpp/msvc.js @@ -19,12 +19,18 @@ function prepareCompiler(product, input, outputs) { args.push('/Os') else if (optimization === 'fast') args.push('/O2') - if (debugInformation) { + + if (debugInformation) args.push('/Zi') - args.push('/MDd') - } else { - args.push('/MD') + + var rtl = ModUtils.moduleProperty(product, "runtimeLibrary"); + if (rtl) { + rtl = (rtl === "static" ? "/MT" : "/MD"); + if (debugInformation) + rtl += "d"; + args.push(rtl); } + // warnings: var warningLevel = ModUtils.moduleProperty(input, "warningLevel") if (warningLevel === 'none') diff --git a/share/qbs/modules/cpp/windows-msvc.qbs b/share/qbs/modules/cpp/windows-msvc.qbs index bc58ee574..773b41fcc 100644 --- a/share/qbs/modules/cpp/windows-msvc.qbs +++ b/share/qbs/modules/cpp/windows-msvc.qbs @@ -17,6 +17,7 @@ CppModule { warningLevel: "default" compilerName: "cl.exe" linkerName: "link.exe" + runtimeLibrary: "dynamic" property bool generateManifestFiles: true property path toolchainInstallPath |
