Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2015-05

fpc.cfg #INCLUDE directive

5 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

patspiper

Hi,

I would like to put my custom cross-compiling switches in an inc file which is '#INCLUDed' in my fpc.cfg. The inc file will be in the same folder of fpc.cfg wherever that is. However, #INCLUDE will look in the current directory if no path is specified and will fail to locate the inc file.

Before submitting a feature request to the bug tracker to have a macro for the fpc.cfg folder (#INCLUDE $FPCCFGFOLDER/myfile.inc), is there any available solution short of hardcoding the #INCLUDE path?

Regards,
Stephano

Reply by email

Jonas Maebe
to patspiper
patspiper wrote 5 lines
I would like to put my custom cross-compiling switches in an inc file which is '#INCLUDed' in my fpc.cfg. The inc file will be in the same folder of fpc.cfg wherever that is. However, #INCLUDE will look in the current directory if no path is specified and will fail to locate the inc file.

You should do it the other way around: include the default fpc.cfg file (which is in a known location, since it's where FPC is installed) in your custom configuration file. That way you don't have to modify fpc.cfg every time a new fpc release (with a new fpc.cfg file) comes out.

You can modify the directories where the compiler looks for included configuration files using the "#CFGDIR xxx" directive inside configuration files. There is no way to specify "the directory where the current configuration file is located" though.

Jonas

Reply by email

patspiper
to Jonas Maebe
Jonas Maebe wrote 11 lines
On 31/05/15 17:31, patspiper wrote: > I would like to put my custom cross-compiling switches in an inc file > which is '#INCLUDed' in my fpc.cfg. The inc file will be in the same > folder of fpc.cfg wherever that is. However, #INCLUDE will look in the > current directory if no path is specified and will fail to locate the > inc file. You should do it the other way around: include the default fpc.cfg file (which is in a known location, since it's where FPC is installed) in your custom configuration file. That way you don't have to modify fpc.cfg every time a new fpc release (with a new fpc.cfg file) comes out.

I'll have to specify the location of fpc.cfg everytime I launch fpc. I am not sure this solves my issue.

You can modify the directories where the compiler looks for included configuration files using the "#CFGDIR xxx" directive inside configuration files.

This can be a good solution. I have just tested it and it worked.

Is it documented anywhere? The online user manual doesn't mention it. Google didn't catch it as well.

There is no way to specify "the directory where the current configuration file is located" though.

Is it possible to have such a feature although it is not crucial anymore?

Thanks,
Stephano

Reply by email

Jonas Maebe
to patspiper
patspiper wrote 7 lines
On 31/05/15 19:01, Jonas Maebe wrote: > You should do it the other way around: include the default fpc.cfg file > (which is in a known location, since it's where FPC is installed) in > your custom configuration file. That way you don't have to modify > fpc.cfg every time a new fpc release (with a new fpc.cfg file) comes out. I'll have to specify the location of fpc.cfg everytime I launch fpc. I am not sure this solves my issue.

You can put this file in one of the default search directories for overrides. See http://www.freepascal.org/docs-html/user/usersu10.html for the list. Additionally, on Windows we now also look in the USERPROFILE and ALLUSERSPROFILE directories (the directories specified by those environment variables).

Show quoted text 7 lines
> You can modify the directories where the compiler looks for included > configuration files using the "#CFGDIR xxx" directive inside > configuration files. This can be a good solution. I have just tested it and it worked. Is it documented anywhere? The online user manual doesn't mention it. Google didn't catch it as well.

It may be an omission in the manual. If so, please file a bug report about that.

> There is no way to specify "the directory where the > current configuration file is located" though. Is it possible to have such a feature although it is not crucial anymore?

Adding non-crucial features is very low on the list, as they still need testing and maintenance.

Jonas

Reply by email

patspiper
to Jonas Maebe
Jonas Maebe wrote 9 lines
>> You can modify the directories where the compiler looks for included >> configuration files using the "#CFGDIR xxx" directive inside >> configuration files. > This can be a good solution. I have just tested it and it worked. > > Is it documented anywhere? The online user manual doesn't mention it. > Google didn't catch it as well. It may be an omission in the manual. If so, please file a bug report about that.

Done:
http://bugs.freepascal.org/view.php?id=28223

Thanks,
Stephano

Reply by email