summaryrefslogtreecommitdiffstats
path: root/mkspecs/features/qt_configure.prf
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-02-09 19:36:50 +0100
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-02-22 07:46:55 +0000
commit52b260fb0fc3342022e0f71120040fdc4429cd25 (patch)
tree9645257fc4f96317623cadeb7b09b20bac3b76a9 /mkspecs/features/qt_configure.prf
parent8ccb46d80ee3271423f7151be5130ea243aa125b (diff)
configure: support using libraries by their exported name
Change-Id: Ibe43c587e83e679baa5f0fc91f452ee06c1e293f Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'mkspecs/features/qt_configure.prf')
-rw-r--r--mkspecs/features/qt_configure.prf50
1 files changed, 45 insertions, 5 deletions
diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf
index 537355dfb8..b5624d276e 100644
--- a/mkspecs/features/qt_configure.prf
+++ b/mkspecs/features/qt_configure.prf
@@ -753,14 +753,53 @@ defineTest(qtConfTest_library) {
defineTest(qtConfTestPrepare_compile) {
for (u, $$list($$eval($${1}.use))) {
libConfig =
- contains($${currentConfig}.libraries._KEYS_, $$u) {
- libConfig = $${currentConfig}
+ exports = $$eval($${currentConfig}.exports.$$u)
+ !isEmpty(exports) {
+ # using a local library by exported name.
+ ru = $$eval($${currentConfig}.found.$$u)
+ !isEmpty(ru) {
+ # if it was already found, all is good.
+ u = $$ru
+ } else: count(exports, 1) {
+ # otherwise, if there is only one option, ensure it's resolved.
+ u = $$exports
+ qtConfHandleLibrary($$u)
+ } else {
+ # otherwise, verify that all options were resolved.
+ for (x, exports) {
+ isEmpty($${currentConfig}.libraries.$${x}.result) {
+ # the higher-level logic is in the features, which we cannot
+ # infer from here. so the only option is failing.
+ error("Test $$1 refers to yet unresolved library export '$$u'")
+ }
+ }
+ return(false)
+ }
+ libConfig = $$currentConfig
+ } else: contains($${currentConfig}.libraries._KEYS_, $$u) {
+ # using a local library by real name. this should be the exception.
qtConfHandleLibrary($$u)
+ libConfig = $$currentConfig
} else {
for (d, QMAKE_LIBRARY_DEPS) {
- contains($${d}.libraries._KEYS_, $$u) {
- libConfig = $$d
- break()
+ exports = $$eval($${d}.exports.$$u)
+ !isEmpty(exports) {
+ # using a foreign library by exported name.
+ # foreign libraries may be external (if they are from a different
+ # repository and the build is modular), and using these by real
+ # name is impossible. so for consistency, uses by real name are
+ # limited to local libraries.
+ ru = $$eval($${d}.found.$$u)
+ !isEmpty(ru) {
+ u = $$ru
+ libConfig = $$d
+ break()
+ }
+ for (x, exports) {
+ isEmpty($${d}.libraries.$${x}.result): \
+ error("Test $$1 refers to unresolved library export '$$u' in '$$d'")
+ }
+ return(false)
}
}
}
@@ -768,6 +807,7 @@ defineTest(qtConfTestPrepare_compile) {
nu = $$upper($$u)
!defined(QMAKE_LIBS_$$nu, var): \
error("Test $$1 tries to use undeclared library '$$u'")
+ # using an external library by exported name.
$${1}.literal_args += $$system_quote(QMAKE_USE += $$u)
} else {
lpfx = $${libConfig}.libraries.$${u}