Bug 84966 - install .pc file when built with cmake
Summary: install .pc file when built with cmake
Status: RESOLVED FIXED
Alias: None
Product: dbus
Classification: Unclassified
Component: core (show other bugs)
Version: 1.5
Hardware: All All
: lowest enhancement
Assignee: D-Bus Maintainers
QA Contact: D-Bus Maintainers
URL:
Whiteboard:
Keywords:
Depends on: 75858
Blocks:
  Show dependency treegraph
 
Reported: 2014-10-13 12:49 UTC by Simon McVittie
Modified: 2017-03-20 14:52 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Simon McVittie 2014-10-13 12:49:27 UTC
When built with Autotools, dbus installs a .pc file for libdbus into ${libdir}/pkg-config. It should ideally do the same in CMake builds, although if Windows people have never needed this functionality, that's far from being a high priority.

The code would look something like this (part of a patch by Руслан Ижбулатов on Bug #75858):

configure_file(${CMAKE_SOURCE_DIR}/../dbus-1.pc.in ${CMAKE_BINARY_DIR}/../dbus-1.pc @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/../dbus-1.pc DESTINATION ${EXPANDED_LIBDIR}/pkgconfig)

Expanding all the variables in the .pc correctly would additionally require something like this:

# Following Autotools naming, for substitution into *.pc, since we share
# Autotools' *.pc.in files.
set(bindir                   ${exec_prefix}/bin)
set(datarootdir              ${prefix}/${DATAROOTDIR})
set(datadir                  ${prefix}/${DATADIR})
set(sysconfdir               ${prefix}/etc)
set(dbus_daemondir           ${bindir})

I have not tested the above, but maybe it already works.

For bonus points you could let pkg-config perform the variable expansion so that the .pc file is relocatable, like it is on Autotools after fixing Bug #75858.
Comment 1 Simon McVittie 2017-03-20 14:52:44 UTC
(In reply to Simon McVittie from comment #0)
> When built with Autotools, dbus installs a .pc file for libdbus into
> ${libdir}/pkg-config. It should ideally do the same in CMake builds

... and now it does. Fixed in 1.11.12 as part of #99721.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.