summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-09-14 15:13:35 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-09-15 10:40:52 +0200
commit488ce1ce371921c891423f54557f66aacd00fb0f (patch)
treed961cf5df9744af12ceb0b5fb48f1095782e06bc /src
parentdfaf374a3d8d34b9aa90bfc4c5e074f9fd8b9981 (diff)
downloadqtwayland-488ce1ce371921c891423f54557f66aacd00fb0f.tar.gz
CMake: Explicitly search for X11 with proper dependency tracking
Replace the hardcoded find_package(X11) with qt_find_package in both the compositor and client projects. This should ensure proper dependency tracking. Calling qt_find_package(X11) is now necessary, because QtGui doesn't publically link against X11 anymore, which means we have to do it explicitly for qtwayland. The relevant qtbase change is 69004cb2900dcfc530e1e2efb783f559661a8a50 The calls need to be protected by an if(NOT TARGET) to prevent configuration issues in static builds, where the dependency does get propagated. This amends commit dfaf374a3d8d34b9aa90bfc4c5e074f9fd8b9981. Change-Id: Ia39e1e78cd0af386d7b48cd1922887289823c1fa Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/client/configure.cmake9
-rw-r--r--src/compositor/configure.cmake7
2 files changed, 15 insertions, 1 deletions
diff --git a/src/client/configure.cmake b/src/client/configure.cmake
index 2310ba8d..6e6b0f33 100644
--- a/src/client/configure.cmake
+++ b/src/client/configure.cmake
@@ -17,7 +17,14 @@ if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
qt_find_package(Wayland PROVIDED_TARGETS Wayland::Egl MODULE_NAME waylandclient QMAKE_LIB wayland-egl)
endif()
qt_find_package(XComposite PROVIDED_TARGETS PkgConfig::XComposite MODULE_NAME waylandclient QMAKE_LIB xcomposite)
-
+# special case begin
+# X11 is not a public dependency of QtGui anymore, so we need to find it manually in a shared build.
+# In a static build the dependency is still propagated, so check for the target existence to prevent
+# the 'Attempt to promote imported target "X11::X11" to global scope' issue.
+if(NOT TARGET X11::X11)
+ qt_find_package(X11 PROVIDED_TARGETS X11::X11 MODULE_NAME gui QMAKE_LIB xlib)
+endif()
+# special case end
#### Tests
diff --git a/src/compositor/configure.cmake b/src/compositor/configure.cmake
index 6d0d8983..73121317 100644
--- a/src/compositor/configure.cmake
+++ b/src/compositor/configure.cmake
@@ -16,6 +16,13 @@ if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
qt_find_package(Waylandkms PROVIDED_TARGETS PkgConfig::Waylandkms MODULE_NAME waylandcompositor QMAKE_LIB wayland-kms)
endif()
qt_find_package(XComposite PROVIDED_TARGETS PkgConfig::XComposite MODULE_NAME waylandcompositor QMAKE_LIB xcomposite)
+# special case begin
+# X11 is not a public dependency of QtGui anymore, so we need to find it manually in a shared build.
+# In a static build the dependency is still propagated, so check for the target existence to prevent
+# the 'Attempt to promote imported target "X11::X11" to global scope' issue.
+if(NOT TARGET X11::X11)
+ qt_find_package(X11 PROVIDED_TARGETS X11::X11 MODULE_NAME gui QMAKE_LIB xlib)
+endif()
#### Tests