[CMake] FindMPI uses wrong fortran include path

Jack Stalnaker omnijack at gmail.com
Wed Feb 10 13:24:50 EST 2016


Hi,

If I call FindMPI, it successfully finds Intel MPI, including all the
proper include paths etc. However, when I compile MPI code, I get an error
message saying that the mod file (called by "use mpi" in the code) was not
compiled by this compiler. The problem appears to be that the Intel
compiler suite installed both gfortran and ifort versions of the mod files
in different include directories like this:

INTELROOT/
    linux/mpi/intel64/include/gfortran/mpi.mod
    linux/mpi/intel64/include/mpi.mod

where the first mod is the gfortran mod, and the second is the intel mod.
Following the call to FindMPI(), the variable MPI_Fortran_INCLUDE_PATH
contains both, with the gfortran directory first. If I do this:

include_directories(${MPI_Fortran_INCLUDE_PATH})

I get the failure I mentioned, presumably because the compiler tries to use
the gfortran mod first.

So is there a way to tell the build system to ignore the gfortran mod? I
cannot assume that the order or contents of MPI_Fortran_INCLUDE_PATH.

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160210/569cf7b2/attachment.html>


More information about the CMake mailing list