From 84f279259713e60449ecf787babb6bdcadc16bea Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 11 Jun 2020 11:49:42 +0200 Subject: [PATCH] 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 --- mkspecs/features/qt.prf | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) 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