From 94ff082d37f160dcef7dc73b60edfcc3fda82728 Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Thu, 9 Feb 2017 14:36:51 +0100 Subject: [PATCH] Add pkgconfig file generating support on unix os to cmake build system. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=99752 --- cmake/CMakeLists.txt | 26 ++++++++++++++++++++++++++ cmake/dbus/CMakeLists.txt | 9 ++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 2c397d2..336f050 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -635,3 +635,29 @@ add_custom_target(help-options cmake -LH WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) + +# +# create pkgconfig file +# +if(UNIX) + set(PLATFORM_LIBS pthread ${LIBRT}) + include(FindPkgConfig QUIET) + if(PKG_CONFIG_FOUND) + # 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}) + configure_file(../dbus-1.pc.in ${CMAKE_BINARY_DIR}/dbus-1.pc @ONLY) + install( + FILES ${CMAKE_BINARY_DIR}/dbus-1.pc + DESTINATION ${EXPANDED_LIBDIR}/pkgconfig + ) + endif() +endif() diff --git a/cmake/dbus/CMakeLists.txt b/cmake/dbus/CMakeLists.txt index dfc4842..ad1a5d7 100644 --- a/cmake/dbus/CMakeLists.txt +++ b/cmake/dbus/CMakeLists.txt @@ -22,6 +22,8 @@ set (dbusinclude_HEADERS ${DBUS_DIR}/dbus-syntax.h ${DBUS_DIR}/dbus-threads.h ${DBUS_DIR}/dbus-types.h +) +set (dbusinclude_ARCH_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/dbus-arch-deps.h ) @@ -304,7 +306,12 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") endif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") install(TARGETS dbus-1 ${INSTALL_TARGETS_DEFAULT_ARGS}) -install(FILES ${dbusinclude_HEADERS} DESTINATION include/dbus) +if(UNIX) + install(FILES ${dbusinclude_HEADERS} DESTINATION include/dbus-1.0/dbus) + install(FILES ${dbusinclude_ARCH_HEADERS} DESTINATION ${EXPANDED_LIBDIR}/dbus-1.0/include/dbus) +else() + install(FILES ${dbusinclude_HEADERS} ${dbusinclude_ARCH_HEADERS} DESTINATION include/dbus) +endif() ### Internal library, used for the daemon, tools and tests, compiled statically. -- 1.8.4.5