From e7fd4257bff2412a74dd27bcc11c106e2e8b0cd5 Mon Sep 17 00:00:00 2001 From: "Tobias C. Berner" Date: Sun, 7 Jan 2024 11:42:23 +0100 Subject: [PATCH] Use pkg-configs imported target to link against DBus To use -ldbus, the value of ${DBus_LIBARARY_DIR} would also need to be added to the linker search paths. To get around this, simply use the imported target by pkgconfig. [1] https://invent.kde.org/network/kdeconnect-kde/-/commit/b8b30ba571d2c155a09bc7d10fb65338e06ecea9 --- CMakeLists.txt | 2 +- plugins/sendnotifications/CMakeLists.txt | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 463b50e1b..db5522024 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,7 +78,7 @@ if(UNIX AND NOT APPLE) find_package(WaylandProtocols REQUIRED) pkg_check_modules(XkbCommon IMPORTED_TARGET xkbcommon) find_package(PkgConfig QUIET REQUIRED) - pkg_check_modules(DBus REQUIRED dbus-1) + pkg_check_modules(DBus REQUIRED IMPORTED_TARGET dbus-1) endif() if (NOT WIN32) diff --git a/plugins/sendnotifications/CMakeLists.txt b/plugins/sendnotifications/CMakeLists.txt index 373579aa3..3b80a4725 100644 --- a/plugins/sendnotifications/CMakeLists.txt +++ b/plugins/sendnotifications/CMakeLists.txt @@ -20,10 +20,7 @@ target_sources(kdeconnect_sendnotifications PRIVATE windowsnotificationslistener target_link_libraries(kdeconnect_sendnotifications runtimeobject windowsapp) else() target_sources(kdeconnect_sendnotifications PRIVATE dbusnotificationslistener.cpp) -target_link_libraries(kdeconnect_sendnotifications ${DBus_LIBRARIES}) -target_include_directories(kdeconnect_sendnotifications - SYSTEM PRIVATE ${DBus_INCLUDE_DIRS} -) +target_link_libraries(kdeconnect_sendnotifications PkgConfig::DBus) endif() # Config