FindMPI: Parse '-l:' flags in pkg-config output
When the linker flags for MPI contain flags starting with -l:
, the FindMPI module fails, e.g., with the following error:
Could NOT find MPI_CXX (missing: MPI_:libmsmpi_LIBRARY MPI_-l:libmsmpi_LIBRARY MPI_CXX_WORKS)
CMake Error at D:/a/msys64/mingw64/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find MPI (missing: MPI_CXX_FOUND)
Call Stack (most recent call first):
D:/a/msys64/mingw64/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
D:/a/msys64/mingw64/share/cmake/Modules/FindMPI.cmake:1830 (find_package_handle_standard_args)
CMakeLists.txt:193 (find_package)
This happens, e.g., with the msmpi
package in MSYS2 for which pkg-config returns the following:
$ pkg-config --libs msmpi
-LC:/msys64/mingw64/lib -l:libmsmpi.dll.a
See also this downstream report: https://github.com/msys2/MINGW-packages/pull/11839
The proposed change adds support for parsing -l:
flags from the pkg-config output.
Fixes: #23620 (closed)
Backport: release
Topic-rename: FindMPI-l-colon
Edited by Brad King