summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-04-24 17:14:25 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-05-02 07:30:42 +0000
commit9b0b464e82071338134700edfa190bf998846e4e (patch)
tree4c0390bb52624fdd063f9495bd939c1c4c7d498f /src
parent42d3b21c92525ea6a430c67e577a5991d679fa1d (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')
-rw-r--r--src/corelib/CMakeLists.txt4
-rw-r--r--src/corelib/configure.cmake18
-rw-r--r--src/gui/CMakeLists.txt2
-rw-r--r--src/gui/configure.cmake40
-rw-r--r--src/network/CMakeLists.txt2
-rw-r--r--src/network/configure.cmake4
-rw-r--r--src/platformsupport/eglconvenience/CMakeLists.txt2
-rw-r--r--src/platformsupport/eventdispatchers/CMakeLists.txt2
-rw-r--r--src/platformsupport/fontdatabases/CMakeLists.txt4
-rw-r--r--src/platformsupport/glxconvenience/CMakeLists.txt4
-rw-r--r--src/platformsupport/input/CMakeLists.txt8
-rw-r--r--src/platformsupport/kmsconvenience/CMakeLists.txt2
-rw-r--r--src/platformsupport/linuxaccessibility/CMakeLists.txt2
-rw-r--r--src/platformsupport/vkconvenience/CMakeLists.txt2
-rw-r--r--src/plugins/generic/tslib/CMakeLists.txt2
-rw-r--r--src/plugins/imageformats/jpeg/CMakeLists.txt2
-rw-r--r--src/plugins/platforminputcontexts/compose/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/cocoa/CMakeLists.txt4
-rw-r--r--src/plugins/platforms/eglfs/CMakeLists.txt4
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/CMakeLists.txt4
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/CMakeLists.txt6
-rw-r--r--src/plugins/platforms/minimal/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/minimalegl/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/xcb/CMakeLists.txt14
-rw-r--r--src/plugins/platformthemes/gtk3/CMakeLists.txt4
-rw-r--r--src/plugins/printsupport/cups/CMakeLists.txt2
-rw-r--r--src/plugins/sqldrivers/configure.cmake6
-rw-r--r--src/plugins/sqldrivers/odbc/CMakeLists.txt2
-rw-r--r--src/plugins/sqldrivers/psql/CMakeLists.txt2
-rw-r--r--src/printsupport/configure.cmake2
-rw-r--r--src/widgets/configure.cmake2
33 files changed, 81 insertions, 81 deletions
diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt
index 37e89a3648..5aee60e7e1 100644
--- a/src/corelib/CMakeLists.txt
+++ b/src/corelib/CMakeLists.txt
@@ -1,8 +1,8 @@
# Generated from corelib.pro.
# special case:
-find_package(Threads)
-find_package(WrapDoubleConversion REQUIRED)
+qt_find_package(Threads PROVIDED_TARGETS Threads::Threads)
+qt_find_package(WrapDoubleConversion REQUIRED PROVIDED_TARGETS WrapDoubleConversion)
if (NOT WrapDoubleConversion_FOUND)
message(FATAL_ERROR "Your C library does not provide \
diff --git a/src/corelib/configure.cmake b/src/corelib/configure.cmake
index 10d2ea60de..e9794dc2a4 100644
--- a/src/corelib/configure.cmake
+++ b/src/corelib/configure.cmake
@@ -10,23 +10,23 @@ set_property(CACHE INPUT_iconv PROPERTY STRINGS undefined no yes posix sun gnu)
#### Libraries
-find_package(GLIB2)
+qt_find_package(GLIB2 PROVIDED_TARGETS GLIB2::GLIB2)
set_package_properties(GLIB2 PROPERTIES TYPE OPTIONAL)
-find_package(ICU COMPONENTS i18n uc data)
+qt_find_package(ICU COMPONENTS i18n uc data PROVIDED_TARGETS ICU::i18n ICU::uc ICU::data)
set_package_properties(ICU PROPERTIES TYPE OPTIONAL)
-find_package(Libsystemd)
+qt_find_package(Libsystemd)
set_package_properties(Libsystemd PROPERTIES TYPE OPTIONAL)
-find_package(Atomic)
+qt_find_package(Atomic PROVIDED_TARGETS Atomic)
set_package_properties(Atomic PROPERTIES TYPE OPTIONAL)
-find_package(WrapRt)
+qt_find_package(WrapRt PROVIDED_TARGETS WrapRt)
set_package_properties(WrapRt PROPERTIES TYPE OPTIONAL)
-find_package(LTTngUST)
+qt_find_package(LTTngUST)
set_package_properties(LTTngUST PROPERTIES TYPE OPTIONAL)
-find_package(PCRE2)
+qt_find_package(PCRE2 PROVIDED_TARGETS PCRE2)
set_package_properties(PCRE2 PROPERTIES TYPE REQUIRED)
-find_package(PPS)
+qt_find_package(PPS)
set_package_properties(PPS PROPERTIES TYPE OPTIONAL)
-find_package(Slog2)
+qt_find_package(Slog2)
set_package_properties(Slog2 PROPERTIES TYPE OPTIONAL)
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
index fb60ac2781..1ddee1692d 100644
--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@ -427,7 +427,7 @@ extend_target(Gui CONDITION QT_FEATURE_draganddrop
# here (where the feature is available).
# DO NOT MOVE THIS TO THE BEGINNING OF THE FILE, the feature variables are not
# available until the add_qt_module call.
-find_package(WrapOpenGL) # special case
+qt_find_package(WrapOpenGL PROVIDED_TARGETS WrapOpenGL) # special case
extend_target(Gui CONDITION QT_FEATURE_opengl
SOURCES
diff --git a/src/gui/configure.cmake b/src/gui/configure.cmake
index b11e06bdb4..3d155e2065 100644
--- a/src/gui/configure.cmake
+++ b/src/gui/configure.cmake
@@ -22,45 +22,45 @@ set_property(CACHE INPUT_xcb PROPERTY STRINGS undefined no yes qt system)
#### Libraries
-find_package(ATSPI2)
+qt_find_package(ATSPI2 PROVIDED_TARGETS PkgConfig::ATSPI2)
set_package_properties(ATSPI2 PROPERTIES TYPE OPTIONAL)
-find_package(Libdrm)
+qt_find_package(Libdrm PROVIDED_TARGETS Libdrm::Libdrm)
set_package_properties(Libdrm PROPERTIES TYPE OPTIONAL)
-find_package(EGL)
+qt_find_package(EGL)
set_package_properties(EGL PROPERTIES TYPE OPTIONAL)
-find_package(Freetype)
+qt_find_package(Freetype PROVIDED_TARGETS Freetype::Freetype)
set_package_properties(Freetype PROPERTIES TYPE REQUIRED)
-find_package(Fontconfig)
+qt_find_package(Fontconfig PROVIDED_TARGETS Fontconfig::Fontconfig)
set_package_properties(Fontconfig PROPERTIES TYPE OPTIONAL)
-find_package(gbm)
+qt_find_package(gbm PROVIDED_TARGETS gbm::gbm)
set_package_properties(gbm PROPERTIES TYPE OPTIONAL)
-find_package(harfbuzz)
+qt_find_package(harfbuzz PROVIDED_TARGETS harfbuzz::harfbuzz)
set_package_properties(harfbuzz PROPERTIES TYPE OPTIONAL)
-find_package(Libinput)
+qt_find_package(Libinput PROVIDED_TARGETS Libinput::Libinput)
set_package_properties(Libinput PROPERTIES TYPE OPTIONAL)
-find_package(JPEG)
+qt_find_package(JPEG)
set_package_properties(JPEG PROPERTIES TYPE OPTIONAL)
-find_package(PNG)
+qt_find_package(PNG PROVIDED_TARGETS PNG::PNG)
set_package_properties(PNG PROPERTIES TYPE OPTIONAL)
-find_package(Mtdev)
+qt_find_package(Mtdev PROVIDED_TARGETS PkgConfig::Mtdev)
set_package_properties(Mtdev PROPERTIES TYPE OPTIONAL)
-find_package(OpenGL)
+qt_find_package(OpenGL)
set_package_properties(OpenGL PROPERTIES TYPE OPTIONAL)
-find_package(GLESv2)
+qt_find_package(GLESv2)
set_package_properties(GLESv2 PROPERTIES TYPE OPTIONAL)
-find_package(Tslib)
+qt_find_package(Tslib PROVIDED_TARGETS PkgConfig::Tslib)
set_package_properties(Tslib PROPERTIES TYPE OPTIONAL)
-find_package(Vulkan)
+qt_find_package(Vulkan)
set_package_properties(Vulkan PROPERTIES TYPE OPTIONAL)
-find_package(Wayland)
+qt_find_package(Wayland)
set_package_properties(Wayland PROPERTIES TYPE OPTIONAL)
-find_package(X11)
+qt_find_package(X11)
set_package_properties(X11 PROPERTIES TYPE OPTIONAL)
-find_package(XCB 1.9)
+qt_find_package(XCB 1.9 PROVIDED_TARGETS XCB::XCB)
set_package_properties(XCB PROPERTIES TYPE OPTIONAL)
-find_package(X11_XCB)
+qt_find_package(X11_XCB PROVIDED_TARGETS X11::XCB)
set_package_properties(X11_XCB PROPERTIES TYPE OPTIONAL)
-find_package(XKB 0.4.1)
+qt_find_package(XKB 0.4.1 PROVIDED_TARGETS XKB::XKB)
set_package_properties(XKB PROPERTIES TYPE OPTIONAL)
diff --git a/src/network/CMakeLists.txt b/src/network/CMakeLists.txt
index 02d31fc468..380ed8e946 100644
--- a/src/network/CMakeLists.txt
+++ b/src/network/CMakeLists.txt
@@ -227,7 +227,7 @@ extend_target(Network CONDITION QT_FEATURE_libproxy AND NOT APPLE_OSX AND (UNIX
kernel/qnetworkproxy_libproxy.cpp
LIBRARIES
${CMAKE_DL_LIBS}
- LibProxy::LibProxy
+ PkgConfig::Libproxy
)
extend_target(Network CONDITION NOT APPLE_OSX AND NOT QT_FEATURE_libproxy AND (UNIX OR WINRT)
diff --git a/src/network/configure.cmake b/src/network/configure.cmake
index 0bb54a6f7d..c765f59c5d 100644
--- a/src/network/configure.cmake
+++ b/src/network/configure.cmake
@@ -6,9 +6,9 @@
#### Libraries
-find_package(Libproxy)
+qt_find_package(Libproxy PROVIDED_TARGETS PkgConfig::Libproxy)
set_package_properties(Libproxy PROPERTIES TYPE OPTIONAL)
-find_package(OpenSSL)
+qt_find_package(OpenSSL)
set_package_properties(OpenSSL PROPERTIES TYPE OPTIONAL)
diff --git a/src/platformsupport/eglconvenience/CMakeLists.txt b/src/platformsupport/eglconvenience/CMakeLists.txt
index 2cbc02073c..f2db6c746e 100644
--- a/src/platformsupport/eglconvenience/CMakeLists.txt
+++ b/src/platformsupport/eglconvenience/CMakeLists.txt
@@ -1,4 +1,4 @@
-find_package(EGL) # special case
+qt_find_package(EGL) # special case
#####################################################################
## EglSupport Module:
diff --git a/src/platformsupport/eventdispatchers/CMakeLists.txt b/src/platformsupport/eventdispatchers/CMakeLists.txt
index ba0d71f03b..4037204f60 100644
--- a/src/platformsupport/eventdispatchers/CMakeLists.txt
+++ b/src/platformsupport/eventdispatchers/CMakeLists.txt
@@ -1,4 +1,4 @@
-find_package(GLIB2) # special case
+qt_find_package(GLIB2) # special case
set_package_properties(GLib PROPERTIES TYPE OPTIONAL) # special case
#####################################################################
diff --git a/src/platformsupport/fontdatabases/CMakeLists.txt b/src/platformsupport/fontdatabases/CMakeLists.txt
index be1047eb13..7a0ef39b25 100644
--- a/src/platformsupport/fontdatabases/CMakeLists.txt
+++ b/src/platformsupport/fontdatabases/CMakeLists.txt
@@ -1,5 +1,5 @@
-find_package(Freetype) # special case
-find_package(Fontconfig) # special case
+qt_find_package(Freetype) # special case
+qt_find_package(Fontconfig) # special case
#####################################################################
## FontDatabaseSupport Module:
diff --git a/src/platformsupport/glxconvenience/CMakeLists.txt b/src/platformsupport/glxconvenience/CMakeLists.txt
index 6bc3e1629e..8480a35125 100644
--- a/src/platformsupport/glxconvenience/CMakeLists.txt
+++ b/src/platformsupport/glxconvenience/CMakeLists.txt
@@ -1,5 +1,5 @@
-find_package(X11) # special case
-find_package(OpenGL) # special case
+qt_find_package(X11) # special case
+qt_find_package(OpenGL) # special case
#####################################################################
## GlxSupport Module:
diff --git a/src/platformsupport/input/CMakeLists.txt b/src/platformsupport/input/CMakeLists.txt
index 1ab85ce239..5ecbbbbe30 100644
--- a/src/platformsupport/input/CMakeLists.txt
+++ b/src/platformsupport/input/CMakeLists.txt
@@ -1,9 +1,9 @@
# Generated from input.pro.
-find_package(Libinput) # special case
-find_package(XKB) # special case
-find_package(Tslib) # special case
-find_package(Mtdev) # special case
+qt_find_package(Libinput) # special case
+qt_find_package(XKB) # special case
+qt_find_package(Tslib) # special case
+qt_find_package(Mtdev) # special case
#####################################################################
## InputSupport Module:
diff --git a/src/platformsupport/kmsconvenience/CMakeLists.txt b/src/platformsupport/kmsconvenience/CMakeLists.txt
index cf006fbeed..1f9f4fbf36 100644
--- a/src/platformsupport/kmsconvenience/CMakeLists.txt
+++ b/src/platformsupport/kmsconvenience/CMakeLists.txt
@@ -1,4 +1,4 @@
-find_package(Libdrm) # special case
+qt_find_package(Libdrm) # special case
#####################################################################
## KmsSupport Module:
diff --git a/src/platformsupport/linuxaccessibility/CMakeLists.txt b/src/platformsupport/linuxaccessibility/CMakeLists.txt
index 5478c9f773..81914f7cd8 100644
--- a/src/platformsupport/linuxaccessibility/CMakeLists.txt
+++ b/src/platformsupport/linuxaccessibility/CMakeLists.txt
@@ -1,4 +1,4 @@
-find_package(ATSPI2 REQUIRED) # special case
+qt_find_package(ATSPI2 REQUIRED) # special case
#####################################################################
## LinuxAccessibilitySupport Module:
diff --git a/src/platformsupport/vkconvenience/CMakeLists.txt b/src/platformsupport/vkconvenience/CMakeLists.txt
index 106f78fb3d..659ee0cdbd 100644
--- a/src/platformsupport/vkconvenience/CMakeLists.txt
+++ b/src/platformsupport/vkconvenience/CMakeLists.txt
@@ -1,4 +1,4 @@
-find_package(Vulkan) # special case
+qt_find_package(Vulkan) # special case
#####################################################################
## VulkanSupport Module:
diff --git a/src/plugins/generic/tslib/CMakeLists.txt b/src/plugins/generic/tslib/CMakeLists.txt
index b46217d845..b4f0c9ab04 100644
--- a/src/plugins/generic/tslib/CMakeLists.txt
+++ b/src/plugins/generic/tslib/CMakeLists.txt
@@ -1,6 +1,6 @@
# Generated from tslib.pro.
-find_package(Tslib) # special case
+qt_find_package(Tslib) # special case
#####################################################################
## qtslibplugin Plugin:
diff --git a/src/plugins/imageformats/jpeg/CMakeLists.txt b/src/plugins/imageformats/jpeg/CMakeLists.txt
index f70c72b992..39c45bc2fe 100644
--- a/src/plugins/imageformats/jpeg/CMakeLists.txt
+++ b/src/plugins/imageformats/jpeg/CMakeLists.txt
@@ -4,7 +4,7 @@
## qjpeg Plugin:
#####################################################################
-find_package(JPEG)
+qt_find_package(JPEG) # special case
add_qt_plugin(qjpeg
TYPE imageformats
diff --git a/src/plugins/platforminputcontexts/compose/CMakeLists.txt b/src/plugins/platforminputcontexts/compose/CMakeLists.txt
index eaa3ac8f73..e903d56d74 100644
--- a/src/plugins/platforminputcontexts/compose/CMakeLists.txt
+++ b/src/plugins/platforminputcontexts/compose/CMakeLists.txt
@@ -4,7 +4,7 @@
## composeplatforminputcontextplugin Plugin:
#####################################################################
-find_package(XKB) # special case
+qt_find_package(XKB) # special case
pkg_get_variable(PKG_X11_PREFIX x11 prefix) # special case
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
diff --git a/src/plugins/platformthemes/gtk3/CMakeLists.txt b/src/plugins/platformthemes/gtk3/CMakeLists.txt
index 18bf562970..af11ddb80a 100644
--- a/src/plugins/platformthemes/gtk3/CMakeLists.txt
+++ b/src/plugins/platformthemes/gtk3/CMakeLists.txt
@@ -1,7 +1,7 @@
# Generated from gtk3.pro.
-find_package(GTK3)
-find_package(X11)
+qt_find_package(GTK3)
+qt_find_package(X11)
#####################################################################
## qgtk3 Plugin:
diff --git a/src/plugins/printsupport/cups/CMakeLists.txt b/src/plugins/printsupport/cups/CMakeLists.txt
index d36a5e7be5..7adf3e72ea 100644
--- a/src/plugins/printsupport/cups/CMakeLists.txt
+++ b/src/plugins/printsupport/cups/CMakeLists.txt
@@ -1,6 +1,6 @@
# Generated from cups.pro.
-find_package(Cups)
+qt_find_package(Cups PROVIDED_TARGETS Cups::Cups) # special case
#####################################################################
## cupsprintersupport Plugin:
diff --git a/src/plugins/sqldrivers/configure.cmake b/src/plugins/sqldrivers/configure.cmake
index 41a66197d1..9f0b0dfc7e 100644
--- a/src/plugins/sqldrivers/configure.cmake
+++ b/src/plugins/sqldrivers/configure.cmake
@@ -6,11 +6,11 @@
#### Libraries
-find_package(PostgreSQL)
+qt_find_package(PostgreSQL PROVIDED_TARGETS PostgreSQL::PostgreSQL)
set_package_properties(PostgreSQL PROPERTIES TYPE OPTIONAL)
-find_package(ODBC)
+qt_find_package(ODBC PROVIDED_TARGETS ODBC::ODBC)
set_package_properties(ODBC PROPERTIES TYPE OPTIONAL)
-find_package(SQLite3)
+qt_find_package(SQLite3)
set_package_properties(SQLite3 PROPERTIES TYPE OPTIONAL)
diff --git a/src/plugins/sqldrivers/odbc/CMakeLists.txt b/src/plugins/sqldrivers/odbc/CMakeLists.txt
index c3c52f526c..4cfbe3b307 100644
--- a/src/plugins/sqldrivers/odbc/CMakeLists.txt
+++ b/src/plugins/sqldrivers/odbc/CMakeLists.txt
@@ -1,4 +1,4 @@
-find_package(ODBC) # special case
+qt_find_package(ODBC) # special case
#####################################################################
## qsqlodbc Plugin:
diff --git a/src/plugins/sqldrivers/psql/CMakeLists.txt b/src/plugins/sqldrivers/psql/CMakeLists.txt
index dfbeaba6de..7b854c365f 100644
--- a/src/plugins/sqldrivers/psql/CMakeLists.txt
+++ b/src/plugins/sqldrivers/psql/CMakeLists.txt
@@ -1,7 +1,7 @@
# FIXME cmake FindPostgreSQL is more exhaustive than the check we have for libpq-fe.h
# it also checks for catalog/pg_type.h which is a more internal include, we should
# add a way to tell cmake FindPostgreSQL to optionally only look for the libpq-fe.h one
-find_package(PostgreSQL) # special case
+qt_find_package(PostgreSQL) # special case
#####################################################################
## qsqlpsql Plugin:
diff --git a/src/printsupport/configure.cmake b/src/printsupport/configure.cmake
index 40aab5d9f7..bede6a503b 100644
--- a/src/printsupport/configure.cmake
+++ b/src/printsupport/configure.cmake
@@ -6,7 +6,7 @@
#### Libraries
-find_package(Cups)
+qt_find_package(Cups PROVIDED_TARGETS Cups::Cups)
set_package_properties(Cups PROPERTIES TYPE OPTIONAL)
diff --git a/src/widgets/configure.cmake b/src/widgets/configure.cmake
index fead6b60b5..a67e12646c 100644
--- a/src/widgets/configure.cmake
+++ b/src/widgets/configure.cmake
@@ -6,7 +6,7 @@
#### Libraries
-find_package(GTK3)
+qt_find_package(GTK3)
set_package_properties(GTK3 PROPERTIES TYPE OPTIONAL)