[Lazarus] Version Info as statement in the *.lpr source file

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Thu Dec 20 15:59:42 CET 2012


Eric Kom wrote:
> On 20/12/2012 11:05, Mark Morgan Lloyd wrote:
>> Eric Kom wrote:
>>> Good day,
>>>
>>> Please am use to pass version info in the project options and would 
>>> like to know if it is possible to pass it directly from the *.lpr 
>>> source file as literal string.
>>
>> Are you talking about the version of the compiler (and/or IDE and/or 
>> LCL) or of your program? And on which operating system? And what do 
>> you want to do with it: use it for conditional compilation or refer to 
>> it while the program's running?
>>
> The version of my program.

If you mean that you want to put something into the .lpr (i.e. the main 
unit of the program) and then use that elsewhere in the program, I've 
been told in the past to do this:

program HeavyWethers;

CONST   projectName= {$I %FILE% } ;

begin
   Application.Initialize;
   GlobalProjectName := projectName;
   Application.CreateForm(...

where GlobalProjectName is a public global in some other unit.

Alternatively note Project Options -> Version Info, see 
http://lists.lazarus.freepascal.org/pipermail/lazarus/2010-July/054335.html 
together with its attachment and/or related messages.

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