From 5e29450d7c14a32b64260931f91fcda29f611eec 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 | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index aafaf5e..581a788 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -634,17 +634,23 @@ if(UNIX) set(PLATFORM_LIBS pthread ${LIBRT}) include(FindPkgConfig QUIET) if(PKG_CONFIG_FOUND) - # convert lists of link libraries into -lstdc++ -lm etc.. + # convert lists of link libraries into -lstdc++ -lm etc.. 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}) + if(CMAKE_LIBRARY_ARCHITECTURE) + set(prefix "\${pcfiledir}/../../../") + else() + set(prefix "\${pcfiledir}/../../") + 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() -- 2.6.6