diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-04-24 17:14:25 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-05-02 07:30:42 +0000 |
commit | 9b0b464e82071338134700edfa190bf998846e4e (patch) | |
tree | 4c0390bb52624fdd063f9495bd939c1c4c7d498f /src/plugins/platforms | |
parent | 42d3b21c92525ea6a430c67e577a5991d679fa1d (diff) |
Write find_dependency() calls in Qt Module config files
This change introduces a new function called qt_find_package()
which can take an extra option called PROVIDED_TARGETS, which
associates targets with the package that defines those targets.
This is done by setting the INTERFACE_QT_PACKAGE_NAME and
INTERFACE_QT_PACKAGE_VERSION properties on the imported targets.
This information allows us to generate appropriate find_dependency()
calls in a module's Config file for third party libraries.
For example when an application links against QtCore, it should also
link against zlib and atomic libraries. In order to do that, the
library locations first have to be found by CMake. This is achieved by
embedding find_dependency(ZLIB) and find_dependency(Atomic) in
Qt5CoreDependencies.cmake which is included by Qt5CoreConfig.cmake.
The latter is picked up when an application project contains
find_package(Qt5Core), and thus all linking dependencies are resolved.
The information 'which package provides which targets' is contained
in the python json2cmake conversion script. The generated output of
the script contains qt_find_package() calls that represent that
information.
The Qt5CoreDependencies.cmake file and which which dependencies it
contains is generated at the QtPostProcess stop.
Note that for non-static Qt builds, we only need to propagate public
3rd party libraries. For static builds, we need all third party
libraries.
In order for the INTERFACE_QT_PACKAGE_NAME property to be read in any
scope, the targets on which the property is set, have to be GLOBAL.
Also for applications and other modules to find all required third
party libraries, we have to install all our custom Find modules, and
make sure they define INTERFACE IMPORTED libraries, and not just
IMPORTED libraries.
Change-Id: I694d6e32d05b96d5e241df0156fc79d0029426aa
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/plugins/platforms')
9 files changed, 20 insertions, 20 deletions
diff --git a/src/plugins/platforms/cocoa/CMakeLists.txt b/src/plugins/platforms/cocoa/CMakeLists.txt index 0b08d49390..9a6902356e 100644 --- a/src/plugins/platforms/cocoa/CMakeLists.txt +++ b/src/plugins/platforms/cocoa/CMakeLists.txt @@ -1,8 +1,8 @@ # Generated from cocoa.pro. # special case: -find_package(Cups) -find_package(WrapOpenGL) +qt_find_package(Cups PROVIDED_TARGETS Cups::Cups) +qt_find_package(WrapOpenGL PROVIDED_TARGETS WrapOpenGL) ##################################################################### ## qcocoa Plugin: diff --git a/src/plugins/platforms/eglfs/CMakeLists.txt b/src/plugins/platforms/eglfs/CMakeLists.txt index 5a4639ddd3..b69f06a499 100644 --- a/src/plugins/platforms/eglfs/CMakeLists.txt +++ b/src/plugins/platforms/eglfs/CMakeLists.txt @@ -1,5 +1,5 @@ -find_package(EGL) -find_package(WrapOpenGL) +qt_find_package(EGL) # special case +qt_find_package(WrapOpenGL PROVIDED_TARGETS WrapOpenGL) # special case ##################################################################### ## EglFSDeviceIntegration Module: diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/CMakeLists.txt index 09a9560f80..214b13be2e 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/CMakeLists.txt +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/CMakeLists.txt @@ -1,7 +1,7 @@ # Generated from eglfs_kms.pro. -find_package(gbm) -find_package(Libdrm) +qt_find_package(gbm) +qt_find_package(Libdrm) ##################################################################### ## qeglfs-kms-integration Plugin: diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/CMakeLists.txt index 9dc5d84523..526c75a882 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/CMakeLists.txt +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from eglfs_kms_egldevice.pro. -find_package(Libdrm) +qt_find_package(Libdrm) ##################################################################### ## qeglfs-kms-egldevice-integration Plugin: diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/CMakeLists.txt index f077ceae4a..96cabe9f1e 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/CMakeLists.txt +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from eglfs_kms_support.pro. -find_package(Libdrm) +qt_find_package(Libdrm) ##################################################################### ## EglFsKmsSupport Module: diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/CMakeLists.txt index aaa4da9cb3..f4487a7747 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/CMakeLists.txt +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/CMakeLists.txt @@ -1,8 +1,8 @@ # Generated from eglfs_x11.pro. -find_package(XCB) -find_package(X11) -find_package(X11_XCB) +qt_find_package(XCB) +qt_find_package(X11) +qt_find_package(X11_XCB) ##################################################################### ## qeglfs-x11-integration Plugin: diff --git a/src/plugins/platforms/minimal/CMakeLists.txt b/src/plugins/platforms/minimal/CMakeLists.txt index 0c3e44e2f1..203a9e3920 100644 --- a/src/plugins/platforms/minimal/CMakeLists.txt +++ b/src/plugins/platforms/minimal/CMakeLists.txt @@ -1,4 +1,4 @@ -find_package(Freetype) # special case +qt_find_package(Freetype) # special case ##################################################################### ## qminimal Plugin: diff --git a/src/plugins/platforms/minimalegl/CMakeLists.txt b/src/plugins/platforms/minimalegl/CMakeLists.txt index f42925f632..6fc52355c8 100644 --- a/src/plugins/platforms/minimalegl/CMakeLists.txt +++ b/src/plugins/platforms/minimalegl/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from minimalegl.pro. -find_package(WrapOpenGL) +qt_find_package(WrapOpenGL PROVIDED_TARGETS WrapOpenGL) # special case ##################################################################### ## qminimalegl Plugin: diff --git a/src/plugins/platforms/xcb/CMakeLists.txt b/src/plugins/platforms/xcb/CMakeLists.txt index 646d9f1976..413599e6c5 100644 --- a/src/plugins/platforms/xcb/CMakeLists.txt +++ b/src/plugins/platforms/xcb/CMakeLists.txt @@ -1,13 +1,13 @@ # Generated from xcb_qpa_lib.pro. # special case: -find_package(X11_XCB) -find_package(X11) -find_package(XCB) -find_package(XKB) -find_package(PkgConfig) -find_package(Freetype) -find_package(GLIB2) +qt_find_package(X11_XCB) +qt_find_package(X11) +qt_find_package(XCB) +qt_find_package(XKB) +qt_find_package(PkgConfig) +qt_find_package(Freetype) +qt_find_package(GLIB2) pkg_check_modules(XKB_COMMON_X11 xkbcommon-x11>=0.4.1 IMPORTED_TARGET) # special case |