From 192c83326ce624a3e2919a2649a8a7a83a8a52b9 Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Sun, 12 Feb 2017 10:43:39 +0100 Subject: [PATCH] cmake: create relocatable dbus-1.pc file Relocatable pkgconfig files are required to use installed packages from a non standard location. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=99721 --- cmake/CMakeLists.txt | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 5eb9ed3..dd25c58 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -614,6 +614,10 @@ if (DBUS_DISABLE_CHECKS) message("NOTE: building without checks for arguments passed to public API makes it harder to debug apps using D-BUS, but will slightly decrease D-BUS library size and _very_ slightly improve performance.") endif(DBUS_DISABLE_CHECKS) +if(CMAKE_LIBRARY_ARCHITECTURE) + message("WARNING: multi architecture library location detected. The generated package may not be usable from non standard install locations.") +endif() + foreach(_note ${FOOTNOTES}) message(${_note}) endforeach() @@ -638,13 +642,21 @@ if(UNIX) foreach(LIB ${CMAKE_C_IMPLICIT_LINK_LIBRARIES} ${PLATFORM_LIBS}) set(LIBDBUS_LIBS "${LIBDBUS_LIBS} -l${LIB}") endforeach() - set(bindir ${EXPANDED_BINDIR}) - set(libdir ${EXPANDED_LIBDIR}) - set(includedir ${EXPANDED_INCLUDEDIR}) - set(sysconfdir ${EXPANDED_SYSCONFDIR}) - set(datadir ${EXPANDED_DATADIR}) - set(datarootdir ${EXPANDED_DATADIR}) - set(dbus_daemondir ${DBUS_DAEMONDIR}) + # no relocatable support for debian multiarch because + # CMAKE_INSTALL_LIBDIR may be overriden on command line + if(CMAKE_INSTALL_LIBDIR STREQUAL "lib" OR CMAKE_INSTALL_LIBDIR STREQUAL "lib64") + set(prefix "\${pcfiledir}/../../") + else() + set(prefix "${CMAKE_INSTALL_PREFIX}") + endif() + set(exec_prefix "\${prefix}") + set(bindir "\${prefix}/${CMAKE_INSTALL_BINDIR}") + set(libdir "\${prefix}/${CMAKE_INSTALL_LIBDIR}") + set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") + set(sysconfdir "\${prefix}/${CMAKE_INSTALL_SYSCONFDIR}") + set(datadir "\${prefix}/${CMAKE_INSTALL_DATADIR}") + set(datarootdir "\${prefix}/${CMAKE_INSTALL_DATADIR}") + set(dbus_daemondir "\${prefix}/${CMAKE_INSTALL_BINDIR}") configure_file(../dbus-1.pc.in ${CMAKE_BINARY_DIR}/dbus-1.pc @ONLY) install(FILES ${CMAKE_BINARY_DIR}/dbus-1.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) endif() -- 1.8.4.5