[Pkg-cmake-team] debhelper: improve cross build support with the cmake buildsystem: multiarch and pkg-config

Niels Thykier niels at thykier.net
Sat Aug 20 19:16:49 UTC 2016

Hi CMake maintainers,

I received the following feature request against debhelper (quoted below
in full for your convenience).  Let me know if you have any comments
about it/them or if you prefer some of them to be done in cmake itself
(notably the pkg-config might be trivial and mroe beneficial to do in
cmake itself).

(NB: Please remember to CC Helmut and Julian on replies if you want them
to react)


On Mon, 8 Aug 2016 18:17:57 +0200 Helmut Grohne <helmut at subdivi.de> wrote:
> Package: debhelper
> Version: 9.20160709
> Tags: patch
> User: helmutg at debian.org
> Usertags: rebootstrap
> Hi Niels et al,
> Julian was kind enough to prepare an experimental apt release that uses
> CMake as its build system, so I could get my hands on it and test cross
> build it. That worked pretty well with two problems both of which we'd
> like to solve in debhelper.
>  * By default CMake's `find_package(PkgConfig)` will not consider cross
>    tools and default to using plain 'pkg-config'. Since Debian's
>    pkg-config has a proper cross wrapper now, not using the
>    triplet-prefixed means that CMake will fail to find libraries.
>    There are a number of options to tell CMake about the right
>    pkg-config. For instance, setting the environment variable
>    PKG_CONFIG=<triplet>-pkg-config is sufficient. In this patch, we pass
>    it as -DPKG_CONFIG_EXECUTABLE=... to keep consistency with other
>    options. Also note that this variable requires an absolute path.
>  * CMake has logic to place libraries in multiarch paths on Debian
>    systems. That logic is disabled for cross compilation. Thus CMake
>    puts libraries in /usr/lib durin cross compilation, which makes e.g.
>    apt fail to cross build. It's not clear what is the best place to fix
>    this, but debhelper certainly is one where this is possible.
>    Arguably, it's a good place, because CMake has no good way to
>    determine whether the host system will be a Debian system.
> The patch is joint work with Julian.
> Helmut

More information about the Pkg-cmake-team mailing list