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>
This commit is contained in:
Joerg Bornemann 2020-06-11 11:49:42 +02:00
parent 019a38fbaa
commit 84f2792597

View File

@ -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