summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/reference/modules/cpp-module.qdoc11
-rw-r--r--share/qbs/modules/cpp/CppModule.qbs1
-rw-r--r--share/qbs/modules/cpp/gcc.js30
-rw-r--r--share/qbs/modules/cpp/windows-mingw.qbs1
4 files changed, 33 insertions, 10 deletions
diff --git a/doc/reference/modules/cpp-module.qdoc b/doc/reference/modules/cpp-module.qdoc
index 818bf578b..f31364359 100644
--- a/doc/reference/modules/cpp-module.qdoc
+++ b/doc/reference/modules/cpp-module.qdoc
@@ -334,6 +334,17 @@
Wrapper binary and its arguments for wrapping compiler calls.
This is useful for compiler wrappers like ccache and alike.
+ \section2 supportedStaticLibrarySuffixes
+
+ \table
+ \row \li \b{Type:} \li \c{stringList}
+ \row \li \b{Default:} \li \c{undefined}
+ \endtable
+
+ List of file suffixes this toolchain's linker accepts as input. For example, for MinGW this list
+ should be \c{[".a", ".lib"]}.
+
+
\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 f6ca753c1..e9bf4bcd6 100644
--- a/share/qbs/modules/cpp/CppModule.qbs
+++ b/share/qbs/modules/cpp/CppModule.qbs
@@ -90,6 +90,7 @@ Module {
property string executablePrefix
property string staticLibrarySuffix
property string dynamicLibrarySuffix
+ property stringList supportedStaticLibrarySuffixes: [staticLibrarySuffix]
property string executableSuffix
property stringList dynamicLibraries // list of names, will be linked with -lname
property stringList staticLibraries // list of static library files
diff --git a/share/qbs/modules/cpp/gcc.js b/share/qbs/modules/cpp/gcc.js
index 701e9c6f5..ce0cf5b8d 100644
--- a/share/qbs/modules/cpp/gcc.js
+++ b/share/qbs/modules/cpp/gcc.js
@@ -8,7 +8,7 @@ function libraryLinkerFlags(product, inputs)
var frameworks = ModUtils.moduleProperties(product, 'frameworks');
var weakFrameworks = ModUtils.moduleProperties(product, 'weakFrameworks');
var rpaths = ModUtils.moduleProperties(product, 'rpaths');
- var args = [], i, prefix, suffix;
+ var args = [], i, prefix, suffix, suffixes;
if (rpaths && rpaths.length)
args.push('-Wl,-rpath,' + rpaths.join(",-rpath,"));
@@ -30,21 +30,25 @@ function libraryLinkerFlags(product, inputs)
args = args.concat(systemFrameworkPaths.map(function(path) { return '-iframework' + path }));
prefix = ModUtils.moduleProperty(product, "staticLibraryPrefix");
- suffix = ModUtils.moduleProperty(product, "staticLibrarySuffix");
+ suffixes = ModUtils.moduleProperty(product, "supportedStaticLibrarySuffixes");
for (i in staticLibraries) {
- if (isLibraryFileName(product, FileInfo.fileName(staticLibraries[i]), prefix, suffix, false))
+ if (isLibraryFileName(product, FileInfo.fileName(staticLibraries[i]), prefix, suffixes,
+ false)) {
args.push(staticLibraries[i]);
- else
+ } else {
args.push('-l' + staticLibraries[i]);
+ }
}
prefix = ModUtils.moduleProperty(product, "dynamicLibraryPrefix");
suffix = ModUtils.moduleProperty(product, "dynamicLibrarySuffix");
for (i in dynamicLibraries) {
- if (isLibraryFileName(product, FileInfo.fileName(dynamicLibraries[i]), prefix, suffix, true))
+ if (isLibraryFileName(product, FileInfo.fileName(dynamicLibraries[i]), prefix, [suffix],
+ true)) {
args.push(dynamicLibraries[i]);
- else
+ } else {
args.push('-l' + dynamicLibraries[i]);
+ }
}
suffix = ".framework";
@@ -66,12 +70,18 @@ function libraryLinkerFlags(product, inputs)
}
// Returns whether the string looks like a library filename
-function isLibraryFileName(product, fileName, prefix, suffix, isShared)
+function isLibraryFileName(product, fileName, prefix, suffixes, isShared)
{
+ var suffix, i;
var os = product.moduleProperty("qbs", "targetOS");
- if (os.contains("unix") && !os.contains("darwin") && isShared)
- suffix += "(\\.[0-9]+){0,3}";
- return fileName.match("^" + prefix + ".+?\\" + suffix + "$");
+ for (i = 0; i < suffixes.length; ++i) {
+ suffix = suffixes[i];
+ if (isShared && os.contains("unix") && !os.contains("darwin"))
+ suffix += "(\\.[0-9]+){0,3}";
+ if (fileName.match("^" + prefix + ".+?\\" + suffix + "$"))
+ return true;
+ }
+ return false;
}
// for compiler AND linker
diff --git a/share/qbs/modules/cpp/windows-mingw.qbs b/share/qbs/modules/cpp/windows-mingw.qbs
index 1c563478e..024f887ab 100644
--- a/share/qbs/modules/cpp/windows-mingw.qbs
+++ b/share/qbs/modules/cpp/windows-mingw.qbs
@@ -9,6 +9,7 @@ GenericGCC {
dynamicLibraryPrefix: ""
executablePrefix: ""
staticLibrarySuffix: ".a"
+ supportedStaticLibrarySuffixes: [".a", ".lib"]
dynamicLibrarySuffix: ".dll"
executableSuffix: ".exe"
windowsApiCharacterSet: "unicode"