[build2] pkgconfig files, header-only libraries, and cppget's boost packages

Boris Kolpackov boris at codesynthesis.com
Mon Sep 26 13:30:54 UTC 2022

Michael Martín Moro via users <users at build2.org> writes:

> They use `import intf_libs` or `import impl_libs` for importing all boost
> dependencies... including header only ones.
> Seems to me like it resuls in pkgconfig files including a lot of extra
> library to link that do not exist. You can check it out with
> libboost-program-options or libboost-random: there are some -lboost_any
> here and -lboost_config there that shouldn't be there.

No, this is by design. We list header-only libraries in pkg-config files
in order to load their own pkg-config files, which may (1) export some
preprocessor options (-I, -D) or (2) link non-header-only libraries that
they may depend upon (in build2 header-only libraries can depend on non-

> It is my understanding that those header-only libraries should be imported
> using `import libs` instead.

There is nothing special about intf_libs/impl_libs/libs after import,
they are just variable names. By convention we use intf_libs/impl_libs
in libraries where it's required to separate interface (intf) and
implementation (impl) libraries and we use libs in executables where
such a separation isn't needed. For background, see:


More information about the users mailing list