Hello,
I use a custom written defines set to determine the fpc version.

-----------------------------------------------------------------------------------------------------------------------------------
program project1;

{$mode objfpc}{$H+}

uses SysUtils;

// fpc 2.0.0
{$IF ((FPC_VERSION = 2) and (FPC_RELEASE = 0) and (FPC_PATCH = 0))}
  {$DEFINE FPC_VER_200}
{$ENDIF}

// fpc 2.0.1
{$IF ((FPC_VERSION = 2) and (FPC_RELEASE = 0) and (FPC_PATCH = 1))}
  {$DEFINE FPC_VER_201}
{$ENDIF}

// fpc >= 2.0.1
{$IF ((FPC_VERSION >= 2) and (FPC_RELEASE >= 0) and (FPC_PATCH >= 1))}
  {$DEFINE FPC_VER_201+}
{$ENDIF}

// fpc = 2.0.2
{$IF ((FPC_VERSION = 2) and (FPC_RELEASE = 0) and (FPC_PATCH = 2))}
  {$DEFINE FPC_VER_202}
{$ENDIF}

begin
  {$IFDEF FPC_VER_200}
  writeln('version 2.0.0');
  {$ENDIF}

  {$IFDEF FPC_VER_201}
  writeln('version 2.0.1');
  {$ENDIF}

  {$IFDEF FPC_VER_201+}
  writeln('version 2.0.1+');
  {$ENDIF}

  {$IFDEF FPC_VER_202}
  writeln('version 2.0.2');
  {$ENDIF}
end.
---------------------------------------------------------------------------------------------------------------------------------
the output from this is:
version 2.0.1
version 2.0.1+
version 2.0.2

I am compiling with FPC 2.0.2. Is this a bug or I have wrong defines????
I have to switch to VER2_0_1, VER2_0_2 compiler defines, but how to
make a 2.0.1+ with those?

Thanks.
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to