[CMake] find_package(mpi) language specification

Andrew Corrigan acorriga at lcp.nrl.navy.mil
Thu Sep 5 12:22:25 EDT 2013


Hello,

My C++ code only uses the MPI C library. 

1. Is there a way to tell find_package(MPI) to only look for the C version?
2. If not, can FindMPI.cmake be changed to support this (just like with Boost you can specify only the components you need)
3. If not, can that warning message  "Could NOT find MPI_CXX missing: MPI_CXX_LIBRARIES MPI_CXX_INCLUDE_PATH" be suppressed?  It is *extremely* confusing to users.

More info:

The language-specific detection for MPI that was added a few versions ago has been a huge help in avoiding linking with the deprecated MPI C++ library.  I still have a problem, and that is find_package(MPI) still attempts to find the MPI C++ library.

When it is not found, which is more often than not the case on the various HPC systems this code runs on, the warning "Could NOT find MPI_CXX missing: MPI_CXX_LIBRARIES MPI_CXX_INCLUDE_PATH" is issued.  I do not want CMake to even try to detect the C++ version of MPI, and this has been a major source of confusion for users of this code, since they think that something has gone wrong and report it to me. In response to this, I added the following clarification, but despite this, users remain confused.

> if(NOT MPI_CXX_FOUND)
>  message(STATUS "==> MPI_CXX_* IS NOT REQUIRED")
>  message(STATUS "==> IGNORE ANY WARNING REGARDING MPI_CXX_*")
> end


Thanks,
Andrew Corrigan



More information about the CMake mailing list