summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Schäpers <schaepers@kuennecke.com>2021-11-09 10:21:32 +0100
committerBjörn Schäpers <qt-codereview@hazardy.de>2021-11-29 12:27:46 +0000
commitbe7d896f4963663c5725c0c35637755c40fe3c0e (patch)
tree6e257dcf105f447ef20ecabf99867c4cb08c329a
parente08c3eedcddbc18b251f56f7158353d8cbec2c81 (diff)
downloadqbs-be7d896f4963663c5725c0c35637755c40fe3c0e.tar.gz
cpp Module: Implement runtimeLibrary property for MinGW
Otherwise there is no possibility to add these arguments, since cpp.linkerFlags are put into -Wl which is not correct for them. Change-Id: I4b9355e082269d390b2afc20bec1376c5d1fcd59 Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
-rw-r--r--doc/reference/modules/cpp-module.qdoc4
-rw-r--r--share/qbs/modules/cpp/MingwBaseModule.qbs1
-rw-r--r--share/qbs/modules/cpp/gcc.js2
3 files changed, 5 insertions, 2 deletions
diff --git a/doc/reference/modules/cpp-module.qdoc b/doc/reference/modules/cpp-module.qdoc
index 936c7373b..6eea7d9e3 100644
--- a/doc/reference/modules/cpp-module.qdoc
+++ b/doc/reference/modules/cpp-module.qdoc
@@ -1069,9 +1069,9 @@
If this property is set to \c{undefined}, the default runtime library of the
toolchain is used.
- \note This property is only functional for MSVC.
+ \note This property is only functional for MSVC and MinGW.
- \defaultvalue \c{"dynamic"} for MSVC, \c{undefined} for other compilers.
+ \defaultvalue \c{"dynamic"} for MSVC and MinGW, \c{undefined} for other compilers.
*/
/*!
diff --git a/share/qbs/modules/cpp/MingwBaseModule.qbs b/share/qbs/modules/cpp/MingwBaseModule.qbs
index 831512c5c..e96f8ba41 100644
--- a/share/qbs/modules/cpp/MingwBaseModule.qbs
+++ b/share/qbs/modules/cpp/MingwBaseModule.qbs
@@ -44,6 +44,7 @@ GenericGCC {
windowsApiCharacterSet: "unicode"
platformDefines: base.concat(WindowsUtils.characterSetDefines(windowsApiCharacterSet))
.concat("WIN32")
+ runtimeLibrary: "dynamic"
Properties {
condition: product.multiplexByQbsProperties.contains("buildVariants")
diff --git a/share/qbs/modules/cpp/gcc.js b/share/qbs/modules/cpp/gcc.js
index 13cdb4a3d..cfcaafb76 100644
--- a/share/qbs/modules/cpp/gcc.js
+++ b/share/qbs/modules/cpp/gcc.js
@@ -529,6 +529,8 @@ function linkerFlags(project, product, inputs, outputs, primaryOutput, linkerPat
Array.prototype.push.apply(escapedLinkerFlags, args);
if (useCompilerDriver)
escapedLinkerFlags = escapedLinkerFlags.concat(Cpp.collectMiscLinkerArguments(product));
+ if (product.qbs.toolchain.contains("mingw") && product.cpp.runtimeLibrary === "static")
+ escapedLinkerFlags = ['-static-libgcc', '-static-libstdc++'].concat(escapedLinkerFlags);
return escapedLinkerFlags;
}