From 47cff0c9fc45bdee31ca1cb87bf82441fae41cfb Mon Sep 17 00:00:00 2001 From: Louis Moureaux Date: Sat, 21 May 2022 19:26:48 +0200 Subject: [PATCH] CMake: Explicitly check for required X11 libraries CMake's FindX11 package reports that X11 was found even if not all libraries are present. It also doesn't support proper components. This causes issues on distros that split X11 headers into a myriad of small packages, for instance Debian: some, but not all, components might be found. Explicitly check that every X11 component used by Plasma was found by FindX11. --- CMakeLists.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index de50fa28d..3c4bf8700 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,6 +121,20 @@ set_package_properties(X11 PROPERTIES DESCRIPTION "X11 libraries" URL "https://www.x.org" TYPE OPTIONAL PURPOSE "Required for building the X11 based workspace") +macro(check_X11_lib) + if (NOT TARGET X11::${ARGV0}) + message(SEND_ERROR "Required component ${ARGV0} of X11 was not found") + endif() +endmacro() +check_X11_lib(ICE) +check_X11_lib(SM) +check_X11_lib(X11) +check_X11_lib(Xau) +check_X11_lib(Xcursor) +check_X11_lib(Xfixes) +check_X11_lib(Xft) +check_X11_lib(Xrender) +check_X11_lib(Xtst) find_package(PkgConfig REQUIRED) pkg_check_modules(PipeWire IMPORTED_TARGET libpipewire-0.3)