fix usage of "empty" libraries
a header-only library in a default location would produce no variables at all, making it appear undefined. fix this by forcing the writeout of the QMAKE_LIBS_* variable, and use its definedness (rather than non-emptiness) as a signifier. this works for both QMAKE_USE and configure tests'/libraries' 'use' entries. Change-Id: Id7a1e23725caba1a91ea4db448b4aeb7fe632393 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
980daa49b2
commit
4f2a571f09
@ -5,25 +5,19 @@ for(ever) {
|
||||
use = $$split(use, /)
|
||||
name = $$take_first(use)
|
||||
nu = $$upper($$name)
|
||||
debug: \
|
||||
libs = $$eval(QMAKE_LIBS_$${nu}_DEBUG)
|
||||
else: \
|
||||
libs = $$eval(QMAKE_LIBS_$${nu}_RELEASE)
|
||||
libs += $$eval(QMAKE_LIBS_$$nu)
|
||||
libdir = $$eval(QMAKE_LIBDIR_$$nu)
|
||||
defines = $$eval(QMAKE_DEFINES_$${nu})
|
||||
includes = $$eval(QMAKE_INCDIR_$${nu})
|
||||
|
||||
isEmpty(libs):isEmpty(defines):isEmpty(includes): \
|
||||
!defined(QMAKE_LIBS_$$nu, var): \
|
||||
error("Library '$$name' is not defined.")
|
||||
|
||||
!contains(use, nolink) {
|
||||
QMAKE_LIBDIR += $$libdir
|
||||
LIBS$${suffix} += $$libs
|
||||
QMAKE_LIBDIR += $$eval(QMAKE_LIBDIR_$$nu)
|
||||
debug: \
|
||||
LIBS$${suffix} += $$eval(QMAKE_LIBS_$${nu}_DEBUG) $$eval(QMAKE_LIBS_$$nu)
|
||||
else: \
|
||||
LIBS$${suffix} += $$eval(QMAKE_LIBS_$${nu}_RELEASE) $$eval(QMAKE_LIBS_$$nu)
|
||||
}
|
||||
!contains(use, linkonly) {
|
||||
DEFINES += $$defines
|
||||
INCLUDEPATH += $$includes
|
||||
DEFINES += $$eval(QMAKE_DEFINES_$${nu})
|
||||
INCLUDEPATH += $$eval(QMAKE_INCDIR_$${nu})
|
||||
}
|
||||
}
|
||||
!isEmpty(suffix): break()
|
||||
|
@ -603,7 +603,8 @@ defineTest(qtConfExportLibrary) {
|
||||
qtConfAddNote("Dropped compiler flags '$$ignored' when detecting library '$$name'.")
|
||||
|
||||
NAME = $$upper($$name)
|
||||
!isEmpty(libs): qtConfOutputVar(assign, $$output, QMAKE_LIBS_$$NAME, $$libs)
|
||||
# LIBS is emitted even if empty, as this allows the library to be "seen".
|
||||
qtConfOutputVar(assign, $$output, QMAKE_LIBS_$$NAME, $$libs)
|
||||
for (b, $${spfx}.builds._KEYS_): \
|
||||
qtConfOutputVar(assign, $$output, QMAKE_LIBS_$${NAME}_$$upper($$b), \
|
||||
$$eval($${spfx}.builds.$${b}))
|
||||
@ -707,11 +708,7 @@ defineTest(qtConfTestPrepare_compile) {
|
||||
}
|
||||
isEmpty(libConfig) {
|
||||
nu = $$upper($$u)
|
||||
libs = $$eval(QMAKE_LIBS_$$nu) $$eval(QMAKE_LIBS_$${nu}_DEBUG) $$eval(QMAKE_LIBS_$${nu}_RELEASE)
|
||||
defines = $$eval(QMAKE_DEFINES_$${nu})
|
||||
includes = $$eval(QMAKE_INCDIR_$${nu})
|
||||
|
||||
isEmpty(libs):isEmpty(defines):isEmpty(includes): \
|
||||
!defined(QMAKE_LIBS_$$nu, var): \
|
||||
error("Test $$1 tries to use undeclared library '$$u'")
|
||||
$${1}.literal_args += $$system_quote(QMAKE_USE += $$u)
|
||||
} else {
|
||||
|
@ -42,6 +42,7 @@ THE_TARGET = $$qt5LibraryTarget($$TARGET)
|
||||
darwin: MODULE_DEBUG_LIBS = -L$$DESTDIR -l$${TARGET}_debug
|
||||
MODULE_RELEASE_LIBS = -L$$DESTDIR -l$$TARGET
|
||||
MODULE_PRI_CONT += \
|
||||
"QMAKE_LIBS_$${ucmodule} =" \ # Needed for the module to be recognized.
|
||||
"QMAKE_LIBS_$${ucmodule}_DEBUG = $$val_escape(MODULE_DEBUG_LIBS)" \
|
||||
"QMAKE_LIBS_$${ucmodule}_RELEASE = $$val_escape(MODULE_RELEASE_LIBS)"
|
||||
} else {
|
||||
|
@ -59,7 +59,7 @@ defineReplace(qtExportLibsForModule) {
|
||||
QMAKE_LIBS_$$NAME QMAKE_LIBS_$${NAME}_DEBUG QMAKE_LIBS_$${NAME}_RELEASE \
|
||||
QMAKE_DEFINES_$$NAME QMAKE_INCDIR_$$NAME
|
||||
for (var, vars) {
|
||||
!isEmpty($$var): \
|
||||
defined($$var, var): \
|
||||
result += "$$var = $$val_escape($$var)"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user