summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2021-06-24 14:27:37 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-06-25 18:04:22 +0000
commit835345b363cfd9fe12342225070322476b856f19 (patch)
tree32ece2078e56f7efc17fe2626bb384504b8ddfc6
parentdf9f2fab16baa5cfaa3b1c4048b28c2413cf7af7 (diff)
Fix linking of debug projects against release Qt on Darwin platforms
Consider a release-only, non-framework Qt build on macOS. Building a debug user project would fail, because qmake tried to link against *_debug.dylib and *_debug.a libraries. Building a debug user project that uses QtUiTools against a release-only framework-build Qt posed the same problem. QMake tried to link against the libQt5UiTools_debug.a, which does not exist. Fix this by maintaining a list of library file candidates, and use the first existing one (or just the first one if none exists). This favors the library matching the user project's configuration but falls back to the release version of the library if necessary. Fixes: QTBUG-81251 Change-Id: I8d641104718edb16500c6d6e3994e736fa5ddcf4 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 50e664835bc2130e8693364641f9aaa7133b6998) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--mkspecs/features/qt.prf43
1 files changed, 25 insertions, 18 deletions
diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf
index 729f3ac73d..6fb657e6f2 100644
--- a/mkspecs/features/qt.prf
+++ b/mkspecs/features/qt.prf
@@ -218,28 +218,35 @@ for(ever) {
# Linking frameworks by absolute path does not work.
LIBS$$var_sfx += -framework $$framework
} else {
- lib = $$MODULE_MODULE$$qtPlatformTargetSuffix()
+ lib_bases = $$MODULE_MODULE$$qtPlatformTargetSuffix()
+ darwin: lib_bases *= $$MODULE_MODULE
win32|contains(MODULE_CONFIG, 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_prefix = $$MODULE_LIBS/$$QMAKE_PREFIX_STATICLIB
+ lib_suffixes = $$QMAKE_EXTENSION_STATICLIB
+ lib_suffixes *= $$QMAKE_LIB_EXTENSIONS
+ add_lib_to_pretargetdeps = true
+ } else {
+ lib_prefix = $$MODULE_LIBS/$$QMAKE_PREFIX_SHLIB
+ lib_suffixes = $$QMAKE_EXTENSION_SHLIB
+ add_lib_to_pretargetdeps = false
+ }
+ candidates =
+ for(lib_base, lib_bases) {
+ for(lib_suffix, lib_suffixes) {
+ candidates += $${lib_prefix}$${lib_base}.$${lib_suffix}
}
- $$lib_missing {
- lib = $$first(candidates)
+ }
+ lib =
+ for(candidate, candidates) {
+ exists("$$candidate") {
+ lib = "$$candidate"
+ break()
}
- PRE_TARGETDEPS += $$lib
- } else {
- lib = $$MODULE_LIBS/$$QMAKE_PREFIX_SHLIB$${lib}.$$QMAKE_EXTENSION_SHLIB
}
+ isEmpty(lib): \
+ lib = $$first(candidates)
+ $$add_lib_to_pretargetdeps: \
+ PRE_TARGETDEPS += $$lib
LIBS$$var_sfx += $$lib
}
}