summaryrefslogtreecommitdiff
path: root/kde-apps/kruler/files/kruler-22.04.3-without_x11.patch
blob: 79bd597d937750f3a92babc8e82be430a4eb768f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
From 7a29873231061948408b36089a683ab4e0fc8a69 Mon Sep 17 00:00:00 2001
From: Andreas Sturmlechner <asturm@gentoo.org>
Date: Sun, 31 Jul 2022 14:59:24 +0200
Subject: [PATCH] Add CMake option to build WITHOUT_X11, drop unused X11
 dependency

We want to be able to build without X11 support even if some of the
used libraries may not work w/o X11 themselves yet or need to be built
with X11 support for other reverse dependencies.

KRULER_HAVE_X11 already exists and is set automagically so far, but
using -DCMAKE_DISABLE_FIND_PACKAGE_X11 will break if any dependencies
list X11 as required in their cmake config.

X11 dependency (introduced in 4c7cab8e90f8f360fb1c6b21c73f4acba609e0fe)
was not actually used at build time, so the new option will replace it
to determine if the feature is enabled, however libXCB remains
non-required.

Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
---
 CMakeLists.txt | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 86a5dc7..a5839ff 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,14 +41,16 @@ set_package_properties(KF5DocTools PROPERTIES DESCRIPTION
     TYPE OPTIONAL
 )
 if (NOT APPLE)
-    find_package(X11)
-    set (KRULER_HAVE_X11 ${X11_FOUND})
-    if (X11_FOUND)
+    option(WITHOUT_X11 "Build without X11 integration (skips finding X11)" OFF)
+    if (NOT WITHOUT_X11)
         find_package(XCB COMPONENTS XCB)
-        if (QT_MAJOR_VERSION STREQUAL "5")
-            find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED X11Extras)
-        else()
-            # qtx11extras_p.h is in Qt6Gui, which implied by the Qt6Gui above
+        set (KRULER_HAVE_X11 ${XCB_FOUND})
+        if (XCB_FOUND)
+            if (QT_MAJOR_VERSION STREQUAL "5")
+                find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED X11Extras)
+            else()
+                # qtx11extras_p.h is in Qt6Gui, which implied by the Qt6Gui above
+            endif()
         endif()
     endif()
 endif()
@@ -101,7 +103,7 @@ target_link_libraries(kruler
     KF5::WindowSystem
     KF5::XmlGui
 )
-if (X11_FOUND)
+if (KRULER_HAVE_X11)
     target_link_libraries(kruler
         ${XCB_LIBRARIES}
     )
-- 
GitLab