]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
cmake: Fix DBUS_SESSION_SOCKET_DIR when cross-compiling
authorAlex Richardson <arichardson.kde@gmail.com>
Sat, 19 Mar 2022 14:56:12 +0000 (14:56 +0000)
committerRalf Habacker <ralf.habacker@freenet.de>
Tue, 29 Mar 2022 11:40:15 +0000 (11:40 +0000)
Inferring it from the environment is not correct, since the host system
could have a different temporary directory defined. Instead of guessing
based on the host, require the user to pass an explicit directory when
cross-compiling. This is helpful for me since I am cross-compiling for
FreeBSD from macOS and on my host TMPDIR is set to
/var/folders/<random characters>/T/ instead of the expected /tmp.

CMakeLists.txt
README.cmake

index ae9700db60da372a8cb7c6cde54a4f06bbb79cdb..cc4926e3a0b602399cc3a5743b74b1ecf69fbc28 100644 (file)
@@ -575,8 +575,14 @@ if(MSVC_IDE)
 endif()
 
 #### Find socket directories
+set(DBUS_SESSION_SOCKET_DIR "" CACHE STRING "Default directory for session socket")
 if(UNIX)
-    if(NOT $ENV{TMPDIR} STREQUAL "")
+    if (CMAKE_CROSSCOMPILING)
+        if (NOT DBUS_SESSION_SOCKET_DIR)
+            message(FATAL_ERROR "cannot autodetect session socket directory "
+                    "when crosscompiling, pass -DDBUS_SESSION_SOCKET_DIR=...")
+        endif()
+    elseif(NOT $ENV{TMPDIR} STREQUAL "")
         set(DBUS_SESSION_SOCKET_DIR $ENV{TMPDIR})
     elseif(NOT $ENV{TEMP} STREQUAL "")
         set(DBUS_SESSION_SOCKET_DIR $ENV{TEMP})
index a1cfc96a73113f12e795f12d44a72fd530adf40d..281b730d11375f427df93e45672a8544879f03d8 100644 (file)
@@ -179,6 +179,9 @@ DBUS_SESSION_BUS_LISTEN_ADDRESS:STRING=autolaunch:
 // session bus fallback address for clients
 DBUS_SESSION_BUS_CONNECT_ADDRESS:STRING=autolaunch:
 
+//Default directory for session socket
+DBUS_SESSION_SOCKET_DIR:STRING=/tmp
+
 // system bus default address (only useful on Unix)
 DBUS_SYSTEM_BUS_DEFAULT_ADDRESS:STRING=unix:path=/var/run/dbus/system_bus_socket