fpc.cfg is not managed by Lazarus, as in this portable installation the paths are also moved, you need to change fpc.cfg contents dynamically as well, primarily the -Fu lines. Note that Lazarus macros (like $(LazarusDir)) won't work there, you must supply actual path.
I just looked at the fpc config file and noticed that the config used a variable: $fpctarget, and I thought, couldn't you somehow pass the $LazarusDir variable to fpc in lazarus or something?
Normally, only a set of compiler-defined variable names are recognized. In addition to these compiler-defined variable names, the following notation can be usedSo to pass the lazarus dir to fpc.cfg you may set an environment var, with say:
$ENVVAR$
I just looked at the fpc config file and noticed that the config used a variable: $fpctarget, and I thought, couldn't you somehow pass the $LazarusDir variable to fpc in lazarus or something?
I think you need to read this in the User's Guide: Variable substitution in paths (https://freepascal.org/docs-html/current/user/userse18.html)
Note specially this paragraph:Quote from: Free Pascal User's GuideNormally, only a set of compiler-defined variable names are recognized. In addition to these compiler-defined variable names, the following notation can be usedSo to pass the lazarus dir to fpc.cfg you may set an environment var, with say:
$ENVVAR$
set LAZDIR="H:\Lazarus"
and, in your fpc.cfg, use $LAZDIR$ wherever you need it.