From “man cmake
”:
The MPI compiler is stored in the cache variable MPI_COMPILER
, and will attempt to look for commonly-named drivers …, mpicxx
, mpiCC
, or mpicc
. If the compiler driver is found and recognized, it will be used to set all of the module variables. To skip this auto-detection, set MPI_LIBRARY
and MPI_INCLUDE_PATH
in the CMake cache.
If no compiler driver is found or the compiler driver is not recognized, this module will then search for common include paths and library names to try to detect MPI.
If CMake initially finds a different MPI than was intended, and you want to use the MPI compiler auto-detection for a different MPI implementation, set MPI_COMPILER
to the MPI compiler driver you want to use (e.g., mpicxx
) and then set MPI_LIBRARY
to the string MPI_LIBRARY-NOTFOUND
. When you re-configure, auto-detection of MPI will run again with the newly-specified MPI_COMPILER
.