[Lazarus] $IF for Linux and FreeBSD platforms?

Ondrej Pokorny lazarus at kluug.net
Thu Feb 16 12:18:33 CET 2017


On 16.02.2017 12:16, Graeme Geldenhuys via Lazarus wrote:
> On 2017-02-16 10:54, Graeme Geldenhuys via Lazarus wrote:
>> The IDE shows that CodeTools knows about the FreeBSD variable, but the
>> code doesn't seem to work,
>
> Doing the following though does work, but it means I have to duplicate
> all $DEFINE lines in two places, which I don't really want to do.
>
>
> {$IFDEF LCLGTK2}
>    {$IFDEF Linux}
>      {$DEFINE something}
>      ...snip.
>    {$ENDIF}
>    {$IFDEF FreeBSD}
>      {$DEFINE something}
>      ...snip.
>    {$ENDIF}
> {$ENDIF}

Well, you mixed up DEFINED and DECLARED macros. The following should work:

{$IFDEF LCLGTK2}
   {$IF DEFINED(Linux) or DEFINED(FreeBSD)}
    {$define something}
   {$endif}
{$endif}
  

Ondrej


More information about the Lazarus mailing list