FindMPI: The -l: syntax confuses MPI library detector
CMake 3.23.2
The following project fails to detect MPI from MSYS2 project where MPI compiler drivers use the -l:
syntax to specify the library to link against.
cmake_minimum_required(VERSION 3.10)
project(testme)
find_package(MPI)
which results in
-- Could NOT find MPI_C (missing: MPI_:libmsmpi_LIBRARY MPI_-l:libmsmpi_LIBRARY MPI_C_WORKS)
-- Could NOT find MPI_CXX (missing: MPI_:libmsmpi_LIBRARY MPI_-l:libmsmpi_LIBRARY MPI_CXX_WORKS)
-- Could NOT find MPI (missing: MPI_C_FOUND MPI_CXX_FOUND)
The MPICC driver call mpicc -show
yields
cc.exe -IC:/msys64/ucrt64/include -LC:/msys64/ucrt64/lib -l:libmsmpi.dll.a
Edited by Brad King