[fpc-pascal] Search path order for fpc.cfg

Michael Van Canneyt michael at freepascal.org
Sun Apr 12 09:58:59 CEST 2020



On Sat, 11 Apr 2020, fredvs via fpc-pascal wrote:

> I promise, it is the last for tonight.
>
> It would be wonderful if in /compiler/globals.pas, at line 906, you add this
> line (or something like that):
>
>     { Replace some macros }
>
> Replace(s,'$FPCPATH',AnsiString(IncludeTrailingBackslash(ExtractFilePath(ParamStr(0)))));
>
> So in fpc.cfg you may do:
>
> -Fu$FPCPATH/units/$fpctarget
> -Fu$FPCPATH/units/$fpctarget/*
> -Fu$FPCPATH/units/$fpctarget/rtl
>
> And it works like charm.

That is _exactly_ what I was talking about when I suggested adding some macros.

I added this:

Replace(s,'$FPCBINDIR',ExtractFilePath(FixFileName(system.paramstr(0))));

Changed the name because 'Path' is used for search paths.

Note that this still may cause surprises, because paramstr(0) is not 100%
reliable.

committed in rev. 44697

Michael.


More information about the fpc-pascal mailing list