FindMPI.cmake: generic pkg-config target names v. concrete implementations
FindMPI.cmake
expects generic pkg-config targets like mpi-{c,cxx,fort}.pc
: https://gitlab.kitware.com/cmake/cmake/-/blob/2744f14db1e87f4b7f6eb6f30f7c84ea52ce4a7a/Modules/FindMPI.cmake#L1584-1592
None of the existing MPI implementations seem to actually generate those. Openmpi currently implements a similar layout (ompi-{c,cxx,fort}.pc
), while mpich exposes cxx and fortran in ad hoc variables in their merged mpich.pc
.
Perhaps downstream package distributions (e.g. Nixpkgs, Debian, etc) could reserve these target names to generate their own distribution-specific pkg-config files with their own overrides: https://github.com/NixOS/nixpkgs/issues/274868. E.g. mpich would be open to supporting an openmpi-like layout (mpich-{c,cxx,fort}.pc
) to facilitate such an approach: https://github.com/pmodels/mpich/issues/6845.
An alternative thought, which I find very reasonable, is that FindMPI.cmake should also look for concrete implementations, because there are only a few of them: https://github.com/open-mpi/ompi/issues/10572#issuecomment-1193387754.
Before any of that happens, it'd be nice to understand which use-case the original code (referencing non-existing targets) was meant to support? What are cmake maintainers' thoughts on how openmpi and mpich handle their package-ability?
Thanks