The FindMPI module that ships with CMake is rather rudimentary. It
identifies some variants of MPICH and MPICH2, but leaves users of
other MPI implementations (Open MPI, LAM-MPI, MS-MPI, etc.) to their
own devices. It also doesn't account for other compile and link flags
needed to link against some MPIs. So, I've rewritten it.

The attached FindMPI.cmake module uses a completely different approach
to detecting the MPI implementation. It starts by looking for the MPI
compiler driver, which is provided by most MPI implementations to help
build MPI programs. It then queries the MPI driver to determine what
flags it uses, based on the various command-line parameters common
drivers provide (e.g., -showme:compile, -showme, -show), and parses
those command lines into compile flags, include paths, link flags,
link libraries, and libraries. If there is no MPI compiler driver, it
falls back to doing what the current FindMPI module does, probing for
specific MPICH variants.

This new FindMPI sets quite a few more variables, since it detects
more information. Of particular note is MPI_LIBRARIES, which will
store all of the libraries that MPI programs need to link against. In
the old FindMPI, we only had MPI_LIBRARY and, optionally,
MPI_EXTRA_LIBRARY, but there is no reason to make this arbitrary
division. Still, this new FindMPI module still sets MPI_LIBRARY and
MPI_EXTRA_LIBRARY, for the sake of backward compatibility. See the top
of the module file for information about the variables this module
sets.

There are two known issues:
  1) Microsoft's MPI (MS-MPI) has different directories for 32-bit vs.
64-bit libraries. How do we know whether we're building in 64-bit mode
to select among the two?
  2) FindMPI.cmake has changed a little on the CMake trunk, but I
haven't yet incorporated those changes.

  - Doug

Attachment: FindMPI.cmake
Description: Binary data

_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to