summaryrefslogtreecommitdiffstats
path: root/mkspecs
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2021-06-24 14:27:37 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2021-06-24 23:18:26 +0200
commit102850557d5f8e9e7f9ede3ced6ae86c33f9018f (patch)
tree12d49c0bf1a6dcd7248baafaea154de03f1a989c /mkspecs
parented4ed7c2d4abfde7d3fd3316410d3b5004a6263f (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> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'mkspecs')
-rw-r--r--mkspecs/features/qt.prf27
1 files changed, 23 insertions, 4 deletions
diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf
index 69d1954306..da1f44a88a 100644
--- a/mkspecs/features/qt.prf
+++ b/mkspecs/features/qt.prf
@@ -215,13 +215,32 @@ for(ever) {
# Linking frameworks by absolute path does not work.
LIBS$$var_sfx += -framework $$framework
} else {
- lib = $$MODULE_MODULE$$qtPlatformTargetSuffix()
+ candidates = $$MODULE_MODULE$$qtPlatformTargetSuffix()
+ darwin: candidates *= $$MODULE_MODULE
win32|contains(MODULE_CONFIG, staticlib) {
- lib = $$MODULE_LIBS/$$QMAKE_PREFIX_STATICLIB$${lib}.$$QMAKE_EXTENSION_STATICLIB
- PRE_TARGETDEPS += $$lib
+ lib_prefix = $$MODULE_LIBS/$$QMAKE_PREFIX_STATICLIB
+ lib_suffix = $$QMAKE_EXTENSION_STATICLIB
+ add_lib_to_pretargetdeps = true
} else {
- lib = $$MODULE_LIBS/$$QMAKE_PREFIX_SHLIB$${lib}.$$QMAKE_EXTENSION_SHLIB
+ lib_prefix = $$MODULE_LIBS/$$QMAKE_PREFIX_SHLIB
+ lib_suffix = $$QMAKE_EXTENSION_SHLIB
+ add_lib_to_pretargetdeps = false
+ }
+ lib_missing = true
+ lib_fallback =
+ for(lib_base, candidates) {
+ lib = $${lib_prefix}$${lib_base}.$${lib_suffix}
+ isEmpty(lib_fallback): \
+ lib_fallback = $$lib
+ exists($$lib) {
+ lib_missing = false
+ break()
+ }
}
+ $$lib_missing: \
+ lib = $$lib_fallback
+ $$add_lib_to_pretargetdeps: \
+ PRE_TARGETDEPS += $$lib
LIBS$$var_sfx += $$lib
}
}