Problem with fpm build --flag

I want to detect unused variables when building a project with fpm. For example:

program main
  implicit none
  integer :: i

end program main

With GFortran, I do:

$ gfortran main.f90 -Wall
main.f90:3:14:

    3 |   integer :: i
      |              1
Warning: Unused variable ā€˜iā€™ declared at (1) [-Wunused-variable]

but fpm says nothing with the same flag:

$ fpm build --flag "-Wall"
fpm: Entering directory '/tmp/essai'
libessai.a                             done.
main.f90                               done.
essai                                  done.
[100%] Project compiled successfully.
fpm: Leaving directory '/tmp/essai'

What am I doing wrong?

By the way, the --flag option seems not documented in the fpm doc.

Have you tried the -verbose output flag? It might be there but hidden.

Thanks @ludnic

yes, with fpm build --verbose I can see it. That interesting option should also be documented (it is cited only in the new fpm publish section of the doc).

But it is really troubling that fpm overrides (or rather hides) my flags in its standard output:

$ fpm build --flag "-Wunused"

does not do what the naive user expects.

Is there the possibility, after compilation, to see the produced warning messages? Without having to dig inside the build directory?
A command like:

fpm log display beatiful_module.f90

Yes, this has been discussed and is planned, see:

3 Likes