[Lazarus] Conditional define via Build mode?

Reinier Olislagers reinierolislagers at gmail.com
Fri Jan 6 16:45:38 CET 2012


On 6-1-2012 16:27, Mattias Gaertner wrote:
> On Fri, 06 Jan 2012 16:01:50 +0100
> Reinier Olislagers <reinierolislagers at gmail.com> wrote:
>> I'm trying to set a conditional symbol depending on build mode. I've got
>> Debug and Release build modes defined.
>>
>> In code, I can do this:
>>   {$DEFINE DEBUG}
>>   {$IFDEF DEBUG}
>>   writeln('Debug: ' + Message);
>>   {$ENDIF DEBUG}
>>
>> How can I set DEBUG only when in Debug build mode? I had a look at the
>> wiki page and the Project Options, Build Macros but I'm a bit lost.
> You have to separate IDE macros and FPC macros.
> FPC macros are defined via the Compiler Options / Custom options, e.g.
> -dDEBUG.
> 
> The "DEBUG:=1" sets an IDE macro.

Thanks Matthias, that's very clear... and works ;)

Reinier




More information about the Lazarus mailing list