regression: 3.23.2: FindMPI on Windows with MS-MPI (MSVC or GCC)
A simple CMakeLists.txt cannot find MPI (MS-MPI) on Windows with CMake 3.23.2.
[I initially thought it was 3.24.0-rc1, but it was actually 3.23.2 that regressed].
This is true with either Ninja
or MinGW Makefiles
generator.
If I copy patched FindMPI.cmake from CMake 3.23.2 install, CMake 3.23.2 then finds MPI.
Working systems
- Linux: GCC 8.5 + OpenMPI
- MacOS: AppleClang 13.1 + OpenMPI
- Windows: Intel oneAPI 2022.2 + Intel MPI
Not working systems
- Windows: Visual Studio 2022 (MSVC 19.32.31329.0) + MS-MPI
- Windows: MSYS2 GCC 12.1 + MS-MPI
MWE
project(oops LANGUAGES C)
find_package(MPI COMPONENTS C REQUIRED)
cmake -Bbuild
results in
cmake -Bbuild
# snip
-- Detecting C compile features
-- Detecting C compile features - done
-- Could NOT find MPI_C (missing: MPI_:libmsmpi_LIBRARY MPI_-l:libmsmpi_LIBRARY MPI_C_WORKS)
cmake -Bbuild --fresh --debug-find-pkg=MPI
reveals bad names in the find_library searches such as:
cmake-3.24.0-rc1-windows-x86_64/share/cmake-3.24/Modules/FindMPI.cmake:825 (find_library):
find_library called with the following settings:
VAR: MPI_:libmsmpi_LIBRARY
NAMES: ":libmsmpi.dll.a"
"lib:libmsmpi.dll.a"
Documentation: Location of the :libmsmpi library for MPI
# snip
cmake-3.24.0-rc1-windows-x86_64/share/cmake-3.24/Modules/FindMPI.cmake:825 (find_library):
find_library called with the following settings:
VAR: MPI_-l:libmsmpi_LIBRARY
NAMES: "-l:libmsmpi.dll.a"
"lib-l:libmsmpi.dll.a"
Documentation: Location of the -l:libmsmpi library for MPI
Similar problems happen for CXX and Fortran if used.
Edited by scivision