popt icon indicating copy to clipboard operation
popt copied to clipboard

Adding way to fetch version of library

Open michal-josef-spacek opened this issue 1 year ago • 3 comments

There is no way to find out the library version programmatically. Could we improve it?

michal-josef-spacek avatar Jun 24 '23 11:06 michal-josef-spacek

It's a bit late add version info, it should have happened years ago. I see people might want to detect version 1.19 and apply a different logic or something

Maybe two new defines should be added to popt.h:

  • POPT_VERSION
  • POPT_REVISION

wdlkmpx avatar Jun 29 '23 03:06 wdlkmpx

It's a bit late add version info, it should have happened years ago.

yes :-)

I see people might want to detect version 1.19 and apply a different logic or something

My use case is Perl module Alien::libpopt (https://metacpan.org/pod/Alien::libpopt) which is going to detect the version. In the case of pkg-config, there is a way how to do it, but on other installations, it's not possible.

Maybe two new defines should be added to popt.h:

  • POPT_VERSION
  • POPT_REVISION

Should be fine.

michal-josef-spacek avatar Jun 29 '23 08:06 michal-josef-spacek

Well the .pc files let the build system know about app/lib version, libraries usually include version info in the headers so that the code knows what to do

The .pc version is not accessible to C/C++ code unless it's passed as a definition -DPOPT_xxx=xxx by the build system (i.e. cmake)

I have some changes that look ok to me... I'll probably open a PR...

wdlkmpx avatar Jun 29 '23 15:06 wdlkmpx