summaryrefslogtreecommitdiff
path: root/kde-frameworks/kdelibs4support/files/kdelibs4support-5.99.0-with_x11.patch
blob: 24bcb1b9cca0c7a5838fcbbc40fddbc55eeedc99 (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
From 026571f37c990007be3d7e536b335c19ab98009e Mon Sep 17 00:00:00 2001
From: Andreas Sturmlechner <asturm@gentoo.org>
Date: Sat, 6 Aug 2022 11:16:00 +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       | 18 +++++++++++-------
 src/CMakeLists.txt   |  6 +++---
 tests/CMakeLists.txt |  2 +-
 3 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f577df45..378d23d4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -51,14 +51,18 @@ if(WIN32)
 endif()
 
 if (NOT APPLE AND NOT WIN32)
-    find_package(X11)
+    option(WITH_X11 "Build with X11 integration and session management" ON)
+    if(WITH_X11)
+        find_package(X11)
+        set(HAVE_X11 ${X11_FOUND})
+        if (HAVE_X11)
+            add_feature_info("X11 Session Management (libSM)" X11_SM_FOUND "Support for session management in KApplication")
+            find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED X11Extras)
+            find_package(XCB REQUIRED COMPONENTS XCB)
+        endif()
+    endif()
 endif()
-set(HAVE_X11 ${X11_FOUND})
-if (HAVE_X11)
-  add_feature_info("X11 Session Management (libSM)" X11_SM_FOUND "Support for session management in KApplication")
-  find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED X11Extras)
-  find_package(XCB REQUIRED COMPONENTS XCB)
-endif ()
+
 if (APPLE)
     cmake_find_frameworks(CoreFoundation)
 endif ()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2096b355..4649a9d5 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -226,7 +226,7 @@ if (NOT KIO_NO_NEPOMUK)
     )
 endif ()
 
-if (X11_FOUND)
+if (HAVE_X11)
    set(libkdelibs4support_SRCS ${libkdelibs4support_SRCS} kdeui/kxerrorhandler.cpp )
    list(APPEND libkdelibs4support_OPTIONAL_LIBS Qt5::X11Extras ${X11_LIBRARIES})
 endif ()
@@ -312,7 +312,7 @@ set(platformLinkLibraries)
 if (APPLE)
     set(platformLinkLibraries "-framework CoreFoundation -framework Carbon -lresolv")
 endif()
-if (X11_FOUND)
+if (HAVE_X11)
     set(platformLinkLibraries ${XCB_XCB_LIBRARY})
 endif()
 
@@ -545,7 +545,7 @@ install( FILES ${CMAKE_CURRENT_BINARY_DIR}/all_languages DESTINATION ${KDE_INSTA
 install( FILES kdeui/40.colors kdeui/Oxygen.colors kdeui/Web.colors kdeui/Royal.colors kdeui/Rainbow.colors
          DESTINATION ${KDE_INSTALL_CONFDIR}/colors)
 
-if (NOT X11_FOUND)
+if (NOT HAVE_X11)
     # install our copy of the rgb.txt named colors list on systems without X11
     install(FILES kdeui/rgb.txt DESTINATION ${KDE_INSTALL_DATADIR_KF5}/kdeui)
 endif ()
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 53f870ff..db4b28db 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -63,7 +63,7 @@ target_link_libraries(networkingservice KF5::KDELibs4Support)
 
 ###### kxerrorhandlertest #####
 
-if (X11_FOUND)
+if (HAVE_X11)
   find_package(Qt5X11Extras ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE)
   kdelibs4support_examples( kxerrorhandlertest )
 
-- 
2.35.1