[Lazarus] Conditional compilation depending on Lazarus version?
Sven Barth
pascaldragon at googlemail.com
Thu Mar 22 11:57:55 CET 2012
Am 22.03.2012 11:32, schrieb Reinier Olislagers:
> 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:
> {$IF LAZARUSREVISION>=36180}
> // 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?
The revision is not possible (when using development versions you should
try to use the latest revision), but for version you can use the unit
LCLVersion. Just add it to the uses clause and then you can use e.g.:
{$if lcl_fullversion>=93100}
// code that should work with 0.9.31 or newer
{$endif}
Just take a look at the unit to see which constants are supported (Note:
it makes use of the feature that constants can be used in compiler
conditionals)
Regards,
Sven
More information about the Lazarus
mailing list