This works whether `BUILD_LIBSYSTEMD` is `ON` or the separate build of
libsystemd picked up by pkg-config is static. The Gentoo Linux package
requires the latter.
This change also handles `BUILD_SHARED_LIBS` being `OFF`. In this case,
the libsystemd dependency does need to be included, even though it is
static.
CMake does not allow you to build shared and static libraries
simultaneously (with a single `add_library` call), but this change
declares the libsystemd dependency as `Requires.private` rather than
omitting it entirely. This is in case someone builds and installs both a
static and shared build and then calls `pkg-config --static sdbus-c++`.
The static build needs to be installed first so that the pkg-config
file from the shared build takes precedence.
* Add methods to initiate custom session bus connection
The new function helper `createSessionBusConnectionWithAddress` allows to create connection to session bus with custom address.
Signed-off-by: Alexander Livenets <a.livenets@gmail.com>
* feat: add support for session bus connection at custom address
Co-authored-by: Stanislav Angelovic <stanislav.angelovic@siemens.com>
* Since ObjectPath and Signature have a user-declared copy-ctor and copy
assignment operator the implicit declaration of corresponding move
operations is disabled. Explicitly add defaulted versions so that
move operations actually move instead of copy.
* See: https://github.com/Kistler-Group/sdbus-cpp/issues/230
fix timeout handling
* Despite what is documented in sd_bus_get_timeout(3), the timeout
returned is actually an absolute time point of Linux's CLOCK_MONOTONIC
clock. Hence, we first have to subtract the current time from the
timeout in order to get a relative time that can be passed to poll.
* For async call timeouts to reliably work, we need a way to notify the
event loop of a connection that is currently blocked waiting in poll.
I.e. assume the event loop thread entered poll with a timeout set to
T1. Afterwards, the main thread starts an async call C with a timeout
T2 < T1. In order for C to be canceled after its timeout T1 has
elapsed, we have to be able to notify the event loop so that it can
update its poll data.
Co-authored-by: Urs Ritzmann <ursritzmann@protonmail.ch>
Co-authored-by: Lukasz Marcul <lukasz.marcul@onemeter.com>
Allow to use human readable chrono literals to specify method call
timeout. The change is backward compatbile - if no unit is provided,
the fallback is "us".
Example:
<annotation name="org.freedesktop.DBus.Method.Timeout" value="500ms"/>
If -DBUILD_TESTS=ON, then creating debian packages fails
because dpkg-shlibdeps obiously can't find the sdbus-c++ dependency
for the tests package.
We could disable CPACK_DEBIAN_PACKAGE_SHLIBDEPS for the tests package.
Nevertheless I don't think we want a tests package at all.
Even though they have the same value, they are something fundamentally different.
Therefore it is extremely confusing if the constant INTERFACE_NAME is passed
where actually a well-known BUS_NAME (destination) should go.