[cmake-developers] FindMPI take 2

Brad King brad.king at kitware.com
Tue Dec 9 11:07:42 EST 2014


On 12/09/2014 06:59 AM, Alin Marin Elena wrote:
> 0001-correctly-detect-MPI-linker-flags-for-Intel-MPI-mayb.patch

Thanks.  That adds a block much like one above it.  Can the preceding
block be modified to match both -Wl, and -Xlinker?  Something like:

-        string(REGEX MATCHALL "(^| )-Wl,([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}")
+        string(REGEX MATCHALL "(^| )(-Wl,|-Xlinker )([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}")

may work (untested).

> 0002-first-try-to-see-if-what-user-provided-produces-an-m.patch

The check for whether the CMAKE_<LANG>_COMPILER is already a MPI
compiler requires a try_compile.  Is there some other way to check
to see if there is any chance before the full test?

Also I'm not sure we fully support using a MPI compiler as the main
compiler.  I can't think of anything that definitely won't work, but
we don't have nightly testing for the case.

Generally I've viewed the MPI compiler interrogation to be much like
using pkg-config or $pkg-config tools to get the info needed to use
a package.  Once that is done then MPI should be treated like any
other library.

> 3. This is a more complex issue and my understanding is that FindMPI
> was designed with mpicc/mpicxx/mpif90 being the workhorse wrappers for
> MPI. While I do not propose to change that I think that implementing
> the change at 2. will somehow mitigate the case of multiple wrappers
> and compilers.

The user should be able to specify MPI_<lang>_COMPILER explicitly.
Perhaps it could be initialized by ENV{MPICC}, ENV{MPICXX}, and
ENV{MPIFC} environment variables?  This selection is much like
picking the primary compiler in the first place.

Thanks,
-Brad



More information about the cmake-developers mailing list