Skip to content

--flag doesn't override the default flags even without --profile #998

Closed
@rouson

Description

@rouson

Description

fpm --help reports "--flag FFLAGS selects compile arguments for the build, the default value is set by the FPM_FFLAGS environment variable. These are added to the profile options if --profile is specified, else these options override the defaults..." But the following transcript excerpt appears to demonstrate otherwise:

fpm new hello
cd hello
fpm build --flag "-O1" --verbose

whereupon I see output that includes lines like

gfortran -c ././src/hello.f90   -O1 -fimplicit-none -Werror=implicit-interface -ffree-form -J build/gfortran_2866DEF92F2F6F01 -Ibuild/gfortran_2866DEF92F2F6F01 -o build/gfortran_2866DEF92F2F6F01/hello/src_hello.f90.o

I'm attempting to build some code that uses fixed-source form, implicit typing, and implicit interfaces. I plan to switch the code to free-source form with no implicit typing and no implicit interfaces, but I didn't write the code so I'd prefer to be able to build the code as is and write tests that will verify that my changes don't break anything. So at least initially, I'd like to override the fpm's default flags, namely -fimplicit-none -Werror=implicit-interface -ffree-form.

Expected Behaviour

I expected that passing --flag "-O1" would override the default flags.

Version of fpm

0.10.0

Platform and Architecture

macOS/Arm

Additional Information

I also tried setting FPM_FFLAGS and that didn't override the defaults either.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions