summaryrefslogtreecommitdiff
path: root/kde-frameworks/kinit/files/kinit-5.96.0-with_x11.patch
blob: fd6efe2fae008c25874bff374f79d2d8e974d7ab (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
65
66
67
68
69
70
71
72
From 85ca4b6515ac2539fb31b74db6fe5ceae1590be1 Mon Sep 17 00:00:00 2001
From: Andreas Sturmlechner <asturm@gentoo.org>
Date: Tue, 2 Aug 2022 00:19:19 +0200
Subject: [PATCH] Add CMake option to build WITH_X11

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.

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. This is a behavior change as previously
it was silently disabled if X11 was not found.

Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
---
 CMakeLists.txt             | 15 +++++++++------
 src/kdeinit/CMakeLists.txt |  4 ++--
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 90baa57..e27c41f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -30,13 +30,16 @@ ecm_setup_version(PROJECT VARIABLE_PREFIX KINIT
 
 #optional features
 if (NOT APPLE)
-    find_package(X11)
+    option(WITH_X11 "Build with X11 integration" ON)
+    if(WITH_X11)
+        find_package(X11 REQUIRED)
+        set(HAVE_X11 1)
+
+        find_package(XCB MODULE COMPONENTS XCB)
+        set_package_properties(XCB PROPERTIES TYPE OPTIONAL)
+        set(HAVE_XCB ${XCB_XCB_FOUND})
+    endif()
 endif()
-set(HAVE_X11 ${X11_FOUND})
-
-find_package(XCB MODULE COMPONENTS XCB)
-set_package_properties(XCB PROPERTIES TYPE OPTIONAL)
-set(HAVE_XCB ${XCB_XCB_FOUND})
 
 # used by 4 executables in this module
 if(HAVE_SOCKET_LIBRARY)
diff --git a/src/kdeinit/CMakeLists.txt b/src/kdeinit/CMakeLists.txt
index af84a14..3fcbd1c 100644
--- a/src/kdeinit/CMakeLists.txt
+++ b/src/kdeinit/CMakeLists.txt
@@ -38,7 +38,7 @@ target_compile_definitions(kdeinit5 PRIVATE
     KDE_INSTALL_FULL_LIBEXECDIR_KF5="${KDE_INSTALL_FULL_LIBEXECDIR_KF5}"
 )
 
-if (X11_FOUND)
+if (HAVE_X11)
   target_link_libraries(kdeinit5 ${X11_X11_LIB})
 endif()
 
@@ -63,7 +63,7 @@ if (NOT WIN32)
 
   target_link_libraries(kdeinit5_wrapper  ${KINIT_SOCKET_LIBRARY} Qt5::Core KF5::DBusAddons)
 
-  if (NOT X11_FOUND)
+  if (NOT HAVE_X11)
     target_compile_definitions(kdeinit5_wrapper PRIVATE -DNO_DISPLAY)
   endif ()
 
-- 
GitLab