Skip to content

Fortran: Do not suppress explicit use of implicit include directories

Since !2855 (merged) we actually populate CMAKE_Fortran_IMPLICIT_INCLUDE_DIRECTORIES for the first time. This value may be useful to project code to pass to other tooling that wants to preprocess the way Fortran does, so we should compute the value. However, compilers like gfortran do not actually search their own implicit include directories for .mod files. The directories must be passed via -I in order for .mod files in them to be found.

Since Fortran has no standard library header files that we need to avoid overriding, it is safe to not filter out implicit include directories from those passed explicitly via -I options. Skip this filtering so that include directories specified by project code to find .mod files will be searched by the compiler even if they happen to be implicitly searched by the preprocessor.

Fixes: #18914 (closed)

Merge request reports