[CMake] MPI wrappers vs FindMPI

Brad King brad.king at kitware.com
Mon Dec 7 08:56:14 EST 2015


On 12/04/2015 05:51 PM, Zaak Beekman wrote:
> What are the pros and cons of using FindMPI over passing FC=mpif90 and CC=mpicc?

It shouldn't matter much if all the code in the project is meant
to be build for MPI.  Using plain FindMPI with the CC/CXX/FC set
to the system compilers is cleaner for building only a subset of
targets for MPI.  FindMPI will look for the MPI compilers separately
in order to ask them for the proper flags to tell the system compiler
how to use MPI, and then project CMake code can take responsibility
for applying that information to the desired subset of its targets.
Using CC=mpicc, FindMPI will recognize that the C compiler is already
a MPI compiler and not bother to look for a separate one to query
the settings (and similarly for C++ and Fortran).

-Brad



More information about the CMake mailing list