[cmake-developers] FeatureSummary and Fortran

Brad King brad.king at kitware.com
Tue Feb 9 16:29:02 EST 2016


On 02/08/2016 10:35 AM, Alin Marin Elena wrote:
> I was playing to day with FeatureSummary and Fortran and I discovered the two 
> do not like each other too much . While MPI is obviously found in here... 
> Feature summary claims it did not
> 
> -- Found MPI_Fortran: /opt/openmpi/gcc/1.10.1/lib64/libmpi_usempif08.so;/opt/
> openmpi/gcc/1.10.1/lib64/libmpi_usempi_ignore_tkr.so;/opt/openmpi/gcc/1.10.1/
> lib64/libmpi_mpifh.so;/opt/openmpi/gcc/1.10.1/lib64/libmpi.so  

Technically it was "MPI_Fortran" that was found.  It looks like FindMPI
distinguishes each of the languages as a kind of sub-package:

 https://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/FindMPI.cmake;hb=v3.4.3#l14

This is different from most other find modules because the results
need to be language-specific.

The actual MPI_FOUND variable is set only based on MPI_CXX_FOUND or
MPI_C_FOUND for compatibility with when there was no language distinction:

 https://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/FindMPI.cmake;hb=v3.4.3#l620

I think MPI_Fortran_FOUND was left out of that because there was no support
for Fortran MPI originally and this language distinction was added as part
of adding support for Fortran.  I was not involved with that development
process myself so I do not know for sure.

One could look at updating the code to treat setting MPI_FOUND as an
official result (as needed by find_package with REQUIRED) rather than only
for compatibility.  This would mean reconciling MPI_C_FOUND, MPI_CXX_FOUND,
and MPI_Fortran_FOUND.  I'm not sure the proper approach because we do not
know which languages the caller actually needs.

-Brad



More information about the cmake-developers mailing list