Skip to content

FindMPI: Add fallback detection code for MPI for cross compiling

Timo Röhling requested to merge roehling/cmake:mpi-cross into master

The MPI libraries use a compiler wrapper to automatically inject required flags and libraries into the compiler argument list. However, the wrapper does not support cross-compiling: the wrapper will try to invoke the native compiler which cannot handle the cross architecture MPI libraries and fail.

This MR adds some fallback code for this case, which tries to bypass the faulty wrapper and determine the necessary flags and libraries directly from the MPI pkg-config files. The patch tries to be as unintrusive as possible and should not break any existing use-cases.

Fixes: #22650 (closed)

Edited by Brad King

Merge request reports