Which prompted the question - where did all those options for gfortran come from? I can’t find them anywhere in the fpm configuration files.
Oh, yeah, the other question, what went wrong, well I can probably sort that out myself when I figure out a bit more about how fpm is going about its business. And yes, I have pored over the documentation.
I guess you have to look into the source code to understand where the flags are coming from. Fpm is coming with two different hard-coded profiles: ‘release’ and ‘debug’.
The flags are found in the fpm_compiler.f90 file. If you want to use you own profile and overwrite the default configuration, you can define a profile in the toml file, see the doc.
name = "my-package"
version = "1.0.0"
[features]
# Release feature with optimization
optim.flags = "-O3"
optim.gfortran.flags = "-funroll-loops"
optim.ifort.flags = "-unroll"
optim.preprocess.cpp.macros = ["NDEBUG"]
[profiles]
optim = ["optim"]
Like this, you can create the profile you want and use it as: fpm run --profile optim
The message is genuinely misleading and it should be fixed imho. what’s gfortran named like on MacPorts? it would look like something like this should work:
It does make one wonder why the default options are not exposed in a configuration file. I’ve never developed software like this so I am not here to second guess, but I’m curious.
Fully customizable and named sets of flags are now possible via features / profiles since v0.13.0
I’ll be the first to admit the original design has some friction re compiler/os/customization support: the default flags were effectively baked in, which is exactly the issue you’re running into. That’s part of why I pushed the features/profiles work into 0.13.0: it’s a substantial improvement and should give you the configurability you’re after.
For the historical context behind the original choices, you can look up the repository issues section, e.g.: