I’ve just started using fpm 0.12.0.
I’d like to specify the default compiler to use with a particular project since my code builds okay with ifx but not gfortran (the default default). I can use the environment variable FPM_FC to specify ifx or use the --compiler option (both work). What I’d like to do is specify it in a configuration e.g. fpm.toml but I can’t find any information in the docs on-line on how to do this.
Many thanks
Simon
fpm does not currently read a configuration file other than the fpm.toml file, which someday will hopefully allow specifying custom profiles and perhaps a default compiler. In addition to the methods you mention, choices include:
- an fpm.rsp response file
- a shell alias command
- a plug-in command
- a wrapper script that sets up an environment and starts a subshell.
GitHub - urbanjost/M_CLI2: Fortran commandline-interface using a simple prototype command has a description on how to write an fpm.rsp response file, which I think is the easiest solution. You can create a default file, but an easy way to start is to create something like
@run
option run --compiler ifx --flag "-O3 " --profile debug --verbose
@build
option build --compiler ifx --flag "-O3 " --profile debug --verbose
@test
option test --compiler ifx --flag "-O3 " --profile debug --verbose
in the top directory of your project and call it “fpm.rsp”, and then you can use fpm like
fpm @test
fpm @build
Edit: corrected URL
Thank you. I will look into this but the link above just gives a 404 error.
Maybe it was the wrong user handle:
Yes that works thanks.
Looking forward to this implementation. It will be a lot nicer than my current method of setting bash aliases to set compiler flags before calling fpm build, test, etc…Fortunately, I am only working on one single project at the moment.