<div dir="ltr">Actually, a quick follow-up on that: I noticed that it doesn't work in every case.<div><br></div><div>It definitely works in some: I can see that some linking options to header-only libraries don't appear in the common pc file, while they do appear in the static/shared ones. So there's definitely something happening here, because that wasn't the case before.</div><div>However, there are still some cases in which header-only linking options do appear in the common pc file. I'm working with a project composed of around 70 different packages (+ the ones imported from boost), and while this used to be an issue for nearly all the pc files, it's now contained within only a few of them... it _seems_ like with this new change, the linking option only appear in pc files from packages which explicitly imported the header-only library. But I'll have to check on this more thorougly before making any definitive conclusion. I'll come back to you later with more details.</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El jue, 12 ene 2023 a las 12:39, Michael Martín Moro (<<a href="mailto:sexymimi64@gmail.com">sexymimi64@gmail.com</a>>) escribió:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi !<div><br></div><div>Sorry, it took me a really long while to put this to the test...</div><div>But back then I did install the build2 staging version from october 2022, and I just tested it today: it works as expected indeed !</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El vie, 30 sept 2022 a las 6:50, Boris Kolpackov (<<a href="mailto:boris@codesynthesis.com" target="_blank">boris@codesynthesis.com</a>>) escribió:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Michael Martín Moro via users <<a href="mailto:users@build2.org" target="_blank">users@build2.org</a>> writes:<br>
<br>
> And I'm pretty sure that doesn't make sense: for instance, the lexical_cast<br>
> boost library is header only, so the `libboost_lexical_cast.so` file will<br>
> never exist. Hence I would assume that writing "-lboost_lexical_cast"<br>
> anywhere wouldn't make sense. Yet the `Libs` field of the generated<br>
> pkgconfig files are filled with such references to header-only libraries.<br>
<br>
It doesn't make sense if you translate -lboost_lexical_cast only to<br>
.a/.so. In build2 we translate -l to .a/.so or, for header-only<br>
libraries, to .pc.<br>
<br>
The underlying problem is this: header-only libraries may, in the<br>
general case, need to convey metadata, just like non-header-only<br>
ones. This can be additional -I/-D options, extra non-header-only<br>
libraries to link, list of importable headers, etc. So in build2<br>
we've "generalized" the -l option to also cover header-only<br>
libraries.<br>
<br>
<br>
> It makes sense to forward non-header-only dependencies of header-only<br>
> libraries to their pkgconfig file.<br>
<br>
While this may work for -I and -L/-l, it won't for -D (and for more<br>
elaborate metadata, like lists of importable headers). Specifically,<br>
consider a header-only library which exports a -D option. It is<br>
linked by two independent non-header-only libraries which are in<br>
turn both linked to an executable. If you "forward" this -D option<br>
to both non-header-only libraries, you will end up with a macro<br>
redefinition.<br>
<br>
<br>
> And the result is that those pkgconfig files cannot be used by the<br>
> pkg-config module for CMake.<br>
<br>
Yes, this is a valid point.<br>
<br>
I went ahead and disabled the generation of -l options for header-only<br>
libraries (along with other build2-specific metadata) in the "common"<br>
.pc file (i.e., non-.{shared,static}.pc). So now the "common" .pc file<br>
will only contain the backwards-compatible information while the<br>
.{shared,static}.pc files will also contain the build2-extended<br>
information.<br>
<br>
This change is available in the latest staged build2 version. If you<br>
could give it a try and confirm things now work as expected, that<br>
would be great: <a href="https://build2.org/community.xhtml#stage" rel="noreferrer" target="_blank">https://build2.org/community.xhtml#stage</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><b>Michaël Martín Moro</b><br>{ Epitech. Tek4 }<br>{ UCA Cadíz - Computer Engineering }<br></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><b>Michaël Martín Moro</b><br>{ Epitech. Tek4 }<br>{ UCA Cadíz - Computer Engineering }<br></div>