[Lazarus] Conditional compilation depending on Lazarus version?

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Thu Mar 22 13:14:13 CET 2012


Reinier Olislagers wrote:
> On 22-3-2012 11:57, Sven Barth wrote:
>> Am 22.03.2012 11:32, schrieb Reinier Olislagers:
>> 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)
> 
> Great, thanks, that works!

At that point if there's an ./ide/revision.inc file containing

// Created by Svn2RevisionInc
const RevisionStr = '35880M';

can it be included into a unit to make it visible at compile time?

And is there a way of getting $i to do something intelligent if the file 
it's looking for doesn't exist?

-- 
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