]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
cmake: In client configuration file get DBus1_xxx variables from cmake target
authorRalf Habacker <ralf.habacker@freenet.de>
Mon, 1 Nov 2021 12:01:59 +0000 (13:01 +0100)
committerRalf Habacker <ralf.habacker@freenet.de>
Tue, 10 Dec 2024 09:12:10 +0000 (10:12 +0100)
The DBus1_xxx variables defined in DBusConfig.cmake for Windows builds
are currently hard-coded values and independent of those of the underlying
cmake target.
To avoid this, these values are retrieved from the corresponding cmake
target. In addition, the cmake allows the construction of the resulting
relocatable runtime paths.

cmake/DBus1Config.cmake.in
dbus/CMakeLists.txt

index 1775b939a52f21e5bb68160beacd3fac886e9c59..e8d9bc34d7b322dc0250fcd4dd81e4d836b58105 100644 (file)
@@ -26,9 +26,10 @@ if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/DBus1Targets.cmake")
         include("${CMAKE_CURRENT_LIST_DIR}/DBus1Targets.cmake")
     endif()
 
-    set(DBus1_DEFINITIONS)
+    # for compatibility, get settings from cmake target
+    get_target_property(DBus1_DEFINITIONS dbus-1 INTERFACE_COMPILE_DEFINITIONS)
     get_target_property(DBus1_INCLUDE_DIRS dbus-1 INTERFACE_INCLUDE_DIRECTORIES)
-    set(DBus1_LIBRARY dbus-1)
+    get_target_property(DBus1_LIBRARY dbus-1 IMPORTED_IMPLIB)
 else()
     message(FATAL_ERROR "Incomplete cmake support in DBus1 find_package configuration")
 endif()
index 1f545ba6bfbe49fc51cd26bc2fb4f41bb2ea010d..aaa5a52df236ec5915bf4d74ffcd3486b343124f 100644 (file)
@@ -299,7 +299,9 @@ else(WIN32)
     endif()
 endif()
 
+# target definitions passed to the clients
 target_include_directories(dbus-1 INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/dbus-1.0>;$<INSTALL_INTERFACE:${CMAKE_INSTALL_LIBDIR}/dbus-1.0/include>)
+target_compile_definitions(dbus-1 INTERFACE "")
 
 # Assume that Linux has -Wl,--version-script and other platforms do not
 if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")