Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rouson opened this issue Feb 24, 2024 · 6 comments
Closed

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

rouson opened this issue Feb 24, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@rouson
Copy link
Contributor

rouson commented Feb 24, 2024

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.

@rouson rouson added the bug Something isn't working label Feb 24, 2024
@rouson rouson changed the title --flag doesn't override the default flags --flag doesn't override the default flags even without --profile Feb 24, 2024
@rouson
Copy link
Contributor Author

rouson commented Feb 24, 2024

This behavior started with version 0.8.0. Version 0.7.0 behaves as expected in accordance with my interpretation of the output of fpm --help.

@perazz
Copy link
Member

perazz commented Feb 24, 2024

I believe you're looking for Fortran features support in fpm.toml: #864 , they were introduced in 0.8.0.

Documentation: https://fpm.fortran-lang.org/spec/manifest.html#implicit-typing

[fortran]
implicit-typing = true  # default: false
implicit-external = true  # default: false
source-form = "fixed"  # "free" (default), or "default" (compiler default)

@rouson
Copy link
Contributor Author

rouson commented Feb 24, 2024

@perazz thanks! I think we should also change the language in the fpm --help output.

@rouson
Copy link
Contributor Author

rouson commented Feb 25, 2024

PR #999 addresses this issue.

@perazz
Copy link
Member

perazz commented Feb 25, 2024

Thank you @rouson for the fix, if you think this issue is closed as far as you're concerned, let's close also this page soon.

@rouson rouson closed this as completed Feb 26, 2024
@rouson
Copy link
Contributor Author

rouson commented Feb 26, 2024

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants