[CMake] FindMPI and version

Clune, Thomas L. (GSFC-6101) thomas.l.clune at nasa.gov
Thu Jul 12 09:03:13 EDT 2018


It appears that MPI_<LANG>_VERSION is returning the version of the MPI _standard_ that is supported by the chosen MPI.   While I am sure this is useful in some contexts, it’s actually not what I want/need for my project and it is quite inconsistent with analogous versions such as CMAKE_<LANG>_COMPILER_VERSION.   E.g., CMAKE_Fortran_COMPILER_VERSION returns something like 18.0.3.xxxxx for my current Intel compiler whereas the Fortran language standard that it nominally supports is 2008.

Our project has dependencies on external libraries that in turn have dependencies on MPI.   We would like to ensure that we choose the external library that was compiled with  the same vendor version of MPI used in our project.    In theory such information can be derived from MPI_<LANG>_LIBRARY_VERSION,   but it is nontrivial and some conventions need to be established.    The proper home for such logic is FindMPI.cmake.

I would not think that we are the only project facing this frustration, but given that MPI_<LANG>_LIBRARY_VERSION is only in the very latest release of cmake, others must have found other means to compensate for this?







More information about the CMake mailing list