diff options
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/client/configure.cmake | 9 | ||||
-rw-r--r-- | src/compositor/configure.cmake | 7 |
3 files changed, 15 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 54d9b68e2..e72c5e1c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,6 @@ project(QtWayland # special case # TODO: Fix warnings and remove this set(QT_REPO_NOT_WARNINGS_CLEAN TRUE) -find_package(X11) find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals ) diff --git a/src/client/configure.cmake b/src/client/configure.cmake index 2310ba8da..6e6b0f33d 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 6d0d89835..731213178 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 |