Description
Just found this Q&A here: https://stackoverflow.com/questions/23991664/gfortran-include-path-is-there-an-alternative-to-passing-multiple-i-options
In summary, GFortran will not use the CPATH
environment variable to resolve Fortran include
or use
directives, the -I
flag has to be manually added with -I
to the command line. In contrast, #include
via the C preprocessor will use the include directories from CPATH
.
With Intel Fortran the situation is different, include
, use
and #include
will use the directories specified in CPATH
to find include files and module files.
For consistency (and convenience), I would suggest we “fix” the GFortran behaviour by automatically adding the entries in CPATH
as include directories to the compile arguments to allow the user to rely on the environment variables rather than having to use --flag
.
Activity
awvwgk commentedon Apr 15, 2021
Here is a patch https://github.com/awvwgk/fortran-package-manager/tree/gfortran-cpath I will propose after the external modules (#438) are merged.
awvwgk commentedon Jan 17, 2022
Here is the respective GFortran ticket for future references https://gcc.gnu.org/bugzilla/show_bug.cgi?id=35707.
Can probably be closed here.