[Lazarus] Conditional compilation depending on Lazarus version?

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Thu Mar 22 11:50:09 CET 2012

Reinier Olislagers wrote:
> Hi list,
> I'm sure I must be missing something.
> I want to compile some grid drawing stuff depending on whether a grid
> bug has been fixed - i.e. I want to do something like this:
> Had a look here:
> http://wiki.lazarus.freepascal.org/IDE_Macros_in_paths_and_filenames
> ... but that only seems to specify support for FPC version, not Lazarus
> version.
> Ideally, I'd be looking at something like:
>   // Note: normally, grid DefaultDrawing property must be off to avoid
> duplicate drawing
>   // This will result in duplicate drawing but should work.
>   DefaultDrawing:=true;
>   {$ENDIF}
> Is something like this possible, or is there an easier way of doing things?
> I realize that the code above will be compiled by FPC, not Lazarus;
> perhaps it is possible to set an environment variable LAZARUSREVISION
> and/or LAZARUSVERSION and get these into FPC macros in some way?

I don't think so, in the general case. The Lazarus revision number can 
probably be found as a .inc in the ide directory, and post about 0.9.24 
you can get the LCL version at runtime, but folding those back into 
something that could be used by a conditional will be problematic.

Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

More information about the Lazarus mailing list