[Lazarus] embed git version info

Xiangrong Fang xrfang at gmail.com
Wed Mar 27 15:18:39 CET 2013


    > How can I embed git version info AUTOMATICALLY while I compile my
program

> > in lazarus, just like {$I %DATE%} ?
>
> Use a pre-compile script (Project Options|Compiler
> Options|Compilation|Execute Before) in combination with a include file.
>

Thanks.

I realized that this may not work for me. Because I need to compile the
project under both Linux and Windows, and then I need 2 scripts in the same
place :-(

Anyway, I tested with the simplest pre-build script:

git describe --always > REVISION.INC


Then in my program I added:

msgs.Lines.Add('GIT HASH: ' + {$I REVISION.INC});

Unfortunately, it does not compile, the error I got is:

unit1.pas(831,50) Error: Identifier not found "c25d546"

It seems that this directive does not load the include file as simple
string??
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20130327/9e00dbec/attachment-0003.html>


More information about the Lazarus mailing list