Commit c8b56ee5e695b50287ffccc36e6c9fb4340aa9b1

Anonymous Maarten 2022-08-26T02:37:57

cmake: add SDL_DBUS option to enable/disable DBUS

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b46bfe8..5c29143 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -440,6 +440,7 @@ set_option(SDL_SSE3                "Use SSE3 assembly routines" ${OPT_DEF_SSEMAT
 set_option(SDL_ALTIVEC             "Use Altivec assembly routines" ${OPT_DEF_ASM})
 set_option(SDL_ARMSIMD             "use SIMD assembly blitters on ARM" OFF)
 set_option(SDL_ARMNEON             "use NEON assembly blitters on ARM" OFF)
+dep_option(SDL_DBUS                "Enable D-Bus support" ON ${UNIX_SYS} OFF)
 set_option(SDL_DISKAUDIO           "Support the disk writer audio driver" ON)
 set_option(SDL_DUMMYAUDIO          "Support the dummy audio driver" ON)
 set_option(SDL_DIRECTFB            "Use DirectFB video driver" OFF)
@@ -1431,12 +1432,15 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU)
     endif()
 
     if(PKG_CONFIG_FOUND)
-      pkg_search_module(DBUS dbus-1 dbus)
-      if(DBUS_FOUND)
-        set(HAVE_DBUS_DBUS_H TRUE)
-        target_include_directories(sdl-build-options INTERFACE "${DBUS_INCLUDE_DIRS}")
-        # Fcitx need only dbus.
-        set(HAVE_FCITX TRUE)
+      if(SDL_DBUS)
+        pkg_search_module(DBUS dbus-1 dbus)
+        if(DBUS_FOUND)
+          set(HAVE_DBUS_DBUS_H TRUE)
+          target_include_directories(sdl-build-options INTERFACE "${DBUS_INCLUDE_DIRS}")
+          # Fcitx need only dbus.
+          set(HAVE_FCITX TRUE)
+          set(HAVE_DBUS TRUE)
+        endif()
       endif()
 
       pkg_search_module(IBUS ibus-1.0 ibus)