[CMake] FindMPI doesn't differentiate between languages

Dave Partyka dave.partyka at kitware.com
Sun Dec 19 16:27:46 EST 2010


Hi Todd,

I have had similar thoughts about this module as well, especially for
providing variables with each of MPI_{C/CXX/FORTRAN}_LIBRARIES but often the
easy way around this is to set CC/CXX/FC environment variables to their
respective mpi compilers before ever running cmake and generally got my
build to behave properly. That said, I would gladly help you in
your endeavor, espeically with testing, code review, etc. The components API
is already present and provides a clean way for the user to tell the find
module to look for specific things (such as libraries). For an example of
this take a look at FindBoost.

Starting off, the best approach is to find the compiler for the languages
you want and interrogate them for the libs, headers, etc. This will get you
the most consistent results.

On Sat, Dec 18, 2010 at 6:04 PM, Todd Gamblin <tgamblin at llnl.gov> wrote:

> Hey all,
>
> This has been brought up before (sort of) here:
>
> http://thread.gmane.org/gmane.comp.programming.tools.cmake.user/26533
>
> FindMPI doesn't currently give you the libraries, includes, etc. for
> different languages. MPI compilers can (and typically do) have different
> includes/libraries depending on the language you're using.  It was noted
> above that you don't get the fortran libraries for MPI using the current
> macro.  Another problem with the current setup is that you're also likely to
> inadvertently get the C++ includes with the current FindMPI, unless you
> explicitly disable them using things like -DOMPI_SKIP_MPICXX.  This can get
> you unwanted C++ symbols in your MPI libraries (because the MPI C++
> interface and headers suck, but that's a whole different story).
>
> I'd be interested in fixing this.  But I would like guidance on how to do
> it.  My inclination would be to make a new version that gives you not just
> MPI_FOUND, MPI_LIBRARIES, etc.. but MPI_<LANG>_FOUND, MPI_<LANG>_LIBRARIES,
> MPI_<LANG>_INCLUDE_PATH, etc.  If you read the thread above, someone
> suggested using components for this back in January, but that was left on
> the table and seems not to have been implemented.
>
> What's the best way to implement proper language support in the FindMPI
> module?
>
> -Todd
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20101219/aa484b56/attachment.htm>


More information about the CMake mailing list