fortran-lang / fpm

Fortran Package Manager (fpm)
https://fpm.fortran-lang.org
MIT License
868 stars 97 forks source link

Improve support for include statements #358

Open LKedward opened 3 years ago

LKedward commented 3 years ago

fpm currently has limited support for source file includes which I notice are used a lot in existing packages and are fundamental to c libraries. Specifically:

I am currently working on an update to fpm to address these shortcomings.

jbdv-no commented 3 years ago

While trying to use fpm (incredible effort by all the developers btw, thank you!) in one of my projects, I have encountered a problem when using include statements with the nagfor compiler.

Nagfor fails to compile since it cannot locate include files (named *.inc, located along with all other *.f90 source files in the ./src directory). The very same directory structure works as expected when using gfortran or ifort to compile.

Searching through fpm's documentation and issues for a solution, lead me to this particular issue, and since I could not find particular mention being made of nagfor in this context before, thought it could be useful to share this very simple reproducer. (Assuming of course that I am using fpm as intended, very possible that a naming/other mistake on my side is causing the trouble)

Reproducing the problem

LKedward commented 3 years ago

Many thanks for the detailed report @jbdv-no, it looks like nagfor behaves slightly differently to gfortran and ifort which first search in the directory of the current source file. The solution for this issue will make the include directory explicit and so should fix your issue also.