Skip to content

XL: Fix using Fortran modules from their output directory

Brad King requested to merge brad.king/cmake:fortran-submodule-test into master

The XL Fortran compiler's -qmoddir= flag sets the module output directory but does not add the directory to the search path for using modules. This is inconsistent with other compilers like the GNU Fortran compiler's -J flag that does both. In order to make these consistent, add the module output directory with a -I flag on the XL Fortran compiler so that it will be searched when using modules too.

This fixes our FortranModules test's coverage of submodules on Ninja + XL. That test places module files in a subdirectory that with Ninja is not the current working directory when the compiler runs. Therefore we can now enable Fortran submodule tests on XL compilers. That part of the test was only accidentally disabled before.

Since commit b66bc660 we try a small test program to see if the Fortran compiler supports submodules. However, a typo in the test program caused it to fail on XL with the error:

1513-083 (E) Internal or module function id was not set within the function.

Fix the typo so that the check passes and enables the submodule tests with XL compilers.

Fixes: #20400 (closed)
Topic-rename: xl-fortran-module-dir-use

Edited by Brad King

Merge request reports

Loading