I want to use an environment variable in FPC configuration file; is this not possible?
I created sample project which demonstrates the problem. I have one main source file and one unit which is located in subdirectory.
I try to compile my program with this bash script:
 
#!/bin/bash
export mvar=meow
fpc="/cygdrive/d/Lazarus/fpc/2.6.2/bin/x86_64-win64/fpc.exe"
options="@cfg.txt -Mobjfpc pro.pas"
$fpc $options
 
In configuration file cfg.txt I have one line of text:
-Fu$mvar
 
It looks like FPC does not substitute $mvar with meow. It does not compile my program.
However if I change options variable to this:
options="@cfg.txt -Mobjfpc pro.pas -Fu$mvar"
Then my program gets compiled successfully.
It means that:
  If I put -Fu$mvar in config file then it does not work
  If I put -Fu$mvar in bash script then it does work
 
Which is strange because in standard config file fpc.cfg I can find not only built-in variables like $FPCVERSION but also environment variables like $LOCAL_APPDATA
 
Examples:
-FuD:\Lazarus\fpc\$FPCVERSION/units/$fpctarget/httpd22
-Fu$LOCAL_APPDATA\FreePascal\fppkg/units/$FPCTARGET/*
This I do not understand. How come that FPC when reading config file understands $LOCAL_APPDATA, but does not substitute variable I specified $mvar
 
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to