diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2020-06-11 11:49:42 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2020-06-11 15:52:26 +0200 |
commit | 84f279259713e60449ecf787babb6bdcadc16bea (patch) | |
tree | 2310586199cc8d1533515b8f06e5faa53e87240b /mkspecs | |
parent | 019a38fbaa0aa286e7152f2539053e7eff1c8142 (diff) |
qmake: Support .dll.a import libraries for MinGW builds of Qt
CMake's default import library extension for MinGW is .dll.a. The code
in qt.prf that resolves the values of the QT variable expected an .a
extension.
To play well with CMake world we keep the the .dll.a extension for
Qt's libraries and teach qt.prf to handle both. In order to do that we
need to check for the existence of the .a or .dll.a file. If none of
these candidates was found we print a warning and fall back to the old
behavior.
Task-number: QTBUG-84781
Change-Id: If394f2d6acd104deb0c3a49240009a1900a506f7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'mkspecs')
-rw-r--r-- | mkspecs/features/qt.prf | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index 4a53b99ca1..d7c6a29196 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -217,7 +217,26 @@ for(ever) { } else { lib = $$MODULE_MODULE$$qtPlatformTargetSuffix() win32|contains(MODULE_CONFIG, staticlib) { - lib = $$MODULE_LIBS/$$QMAKE_PREFIX_STATICLIB$${lib}.$$QMAKE_EXTENSION_STATICLIB + lib_missing = true + lib_extensions = $$QMAKE_EXTENSION_STATICLIB + lib_extensions *= $$QMAKE_LIB_EXTENSIONS + candidates = + for(ext, lib_extensions) { + candidate = $$MODULE_LIBS/$$QMAKE_PREFIX_STATICLIB$${lib}.$$ext + candidates += $$candidate + exists($$candidate) { + lib = $$candidate + lib_missing = false + break() + } + } + $$lib_missing { + msg = "Cannot find library for $${MODULE_MODULE}. Tried:$$escape_expand(\\n)" + for(path, candidates): \ + msg += "$$path$$escape_expand(\\n)" + warning($$msg) + lib = $$first(candidates) + } PRE_TARGETDEPS += $$lib } else { lib = $$MODULE_LIBS/$$QMAKE_PREFIX_SHLIB$${lib}.$$QMAKE_EXTENSION_SHLIB |