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

fredvs fiens at hotmail.com
Sat Apr 11 02:40:04 CEST 2020


> Does fpc accept relative path for -Fu in the fpc.cfg config file, something
> like:

> -Fu./units/$fpctarget
> -Fu./units/$fpctarget/*
> -Fu./units/$fpctarget/rtl 

No, it seems that it is not possible.

So I propose to do this, dont hurt existing code, only gives happiness:

in cfileutls.pas do this:

procedure TSearchPathList.AddPath(s:TCmdStr;addfirst:boolean);  
    begin
      if system.copy(s,1,2) = './' then
     begin         s :=
AnsiString(IncludeTrailingBackslash(ExtractFilePath(ParamStr(0))) + 
         system.copy(s,3,length(s)-2));
      end;
      AddLibraryPath('',s,AddFirst);
     end;

Tested and re-tested, committed, it works like charms, with fpc.cfg in same
dir than fpc (first patch):

# searchpath for units and other system dependent things
-Fu./units/$fpctarget
-Fu./units/$fpctarget/*
-Fu./units/$fpctarget/rtl

OK, I let you in peace.

Take care of you.

Fre;D



--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/


More information about the fpc-pascal mailing list