Hi Jef,

On 3/17/10 8:23 AM, Jef Driesen wrote:
I only need it compiled into my library. The goal is that an application using my library can report the exact revision of the library (for diagnostic purpose).

With the solution I outlined in my previous posts, I can already get the "normal" version info (e.g. the major.minor.micro numbers) into a public header file to allow for compile time version checking. Runtime version checking can easily be achieved by adding a mylib_get_version() function to the library. But when building not yet released code, it's more useful to know the exact SCM revision, rather than the version numbers.



I compile the svn revision into my program so it can be included in `--version output'. It is based on a solution described here

http://www.mhoenicka.de/system-cgi/blog/index.php?itemid=999

I've modified it a bit to avoid unnecessary compilations and to allow building from an 'svn export'. You can see the details on how it is done here

http://dev.thep.lu.se/svndigest/browser/trunk/lib/Makefile.am

In short, we use two different modes. 1) If we are building from svn wc and 2) if we are building from a tarball or svn export. We test which mode we're in by detecting `$srcdir/.svn' at configure time and create a automake conditional. In case 1) we use svnversion (included in subversion) to create subversion_info.cc from subversion_info.cc.in, whereas in case 2) we do not touch subversion_info.cc.

I hope that helps and if you have any question please let me know.

Thanks,
Peter



Reply via email to