regression: 3.22 FindMPI error on Windows with Ninja Multi-Config
With MinGW GCC or Intel oneAPI on Windows with Ninja Multi-Config, FindMPI errors on an MWE.
This does NOT appear to happen on Linux.
This is new for CMake 3.22.
cmake_minimum_required(VERSION 3.14)
project(gen LANGUAGES C)
find_package(MPI)
MinGW GCC
> cmake -B build -G "Ninja Multi-Config"
-- The C compiler identification is GNU 11.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/msys64/mingw64/bin/cc.exe
-- Check for working C compiler: C:/msys64/mingw64/bin/cc.exe - works
-- Detecting C compile features
-- Detecting C compile features - done
CMake Warning (dev) at cmake-3.22.0-rc2-windows-x86_64/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (PkgConfig)
does not match the name of the calling package (MPI). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
cmake-3.22.0-rc2-windows-x86_64/share/cmake-3.22/Modules/FindPkgConfig.cmake:88 (find_package_handle_standard_args)
cmake-3.22.0-rc2-windows-x86_64/share/cmake-3.22/Modules/FindMPI.cmake:270 (include)
CMakeLists.txt:5 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Found PkgConfig: C:/msys64/mingw64/bin/pkgconf.exe (found version "1.8.0")
CMake Error at cmake-3.22.0-rc2-windows-x86_64/share/cmake-3.22/Modules/FindMPI.cmake:1264 (try_compile):
Cannot copy output executable
''
to destination specified by COPY_FILE:
'C:/temp/build/CMakeFiles/FindMPI/test_mpi_C.bin'
Unable to find the executable at any of:
C:/temp/build/CMakeFiles/CMakeTmp/cmTC_1b758.exe
C:/temp/build/CMakeFiles/CMakeTmp/Debug/cmTC_1b758.exe
C:/temp/build/CMakeFiles/CMakeTmp/Development/cmTC_1b758.exe
Call Stack (most recent call first):
cmake-3.22.0-rc2-windows-x86_64/share/cmake-3.22/Modules/FindMPI.cmake:1315 (_MPI_try_staged_settings)
cmake-3.22.0-rc2-windows-x86_64/share/cmake-3.22/Modules/FindMPI.cmake:1638 (_MPI_check_lang_works)
CMakeLists.txt:5 (find_package)
CMake Error at cmake-3.22.0-rc2-windows-x86_64/share/cmake-3.22/Modules/FindMPI.cmake:1741 (file):
file STRINGS file "C:/temp/build/CMakeFiles/FindMPI/test_mpi_C.bin" cannot
be read.
Call Stack (most recent call first):
CMakeLists.txt:5 (find_package)
-- Found MPI_C: C:/msys64/mingw64/lib/libmsmpi.a
-- Found MPI: TRUE
-- Configuring incomplete, errors occurred!
See also "C:/temp/build/CMakeFiles/CMakeOutput.log".
See also "C:/temp/build/CMakeFiles/CMakeError.log".
Intel oneAPI
cmake -B build -G "Ninja Multi-Config"
-- The C compiler identification is IntelLLVM 2021.4.0 with MSVC-like command-line
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/icx.exe
-- Check for working C compiler: C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/icx.exe - works
-- Detecting C compile features
-- Detecting C compile features - done
CMake Warning (dev) at cmake-3.22.0-rc2-windows-x86_64/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (PkgConfig)
does not match the name of the calling package (MPI). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
cmake-3.22.0-rc2-windows-x86_64/share/cmake-3.22/Modules/FindPkgConfig.cmake:88 (find_package_handle_standard_args)
cmake-3.22.0-rc2-windows-x86_64/share/cmake-3.22/Modules/FindMPI.cmake:270 (include)
CMakeLists.txt:5 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Found PkgConfig: C:/msys64/mingw64/bin/pkgconf.exe (found version "1.8.0")
CMake Error at cmake-3.22.0-rc2-windows-x86_64/share/cmake-3.22/Modules/FindMPI.cmake:1264 (try_compile):
Cannot copy output executable
''
to destination specified by COPY_FILE:
'C:/temp/build/CMakeFiles/FindMPI/test_mpi_C.bin'
Unable to find the executable at any of:
C:/temp/build/CMakeFiles/CMakeTmp/cmTC_8258f.exe
C:/temp/build/CMakeFiles/CMakeTmp/Debug/cmTC_8258f.exe
C:/temp/build/CMakeFiles/CMakeTmp/Development/cmTC_8258f.exe
Call Stack (most recent call first):
cmake-3.22.0-rc2-windows-x86_64/share/cmake-3.22/Modules/FindMPI.cmake:1315 (_MPI_try_staged_settings)
cmake-3.22.0-rc2-windows-x86_64/share/cmake-3.22/Modules/FindMPI.cmake:1638 (_MPI_check_lang_works)
CMakeLists.txt:5 (find_package)
CMake Error at cmake-3.22.0-rc2-windows-x86_64/share/cmake-3.22/Modules/FindMPI.cmake:1741 (file):
file STRINGS file "C:/temp/build/CMakeFiles/FindMPI/test_mpi_C.bin" cannot
be read.
Call Stack (most recent call first):
CMakeLists.txt:5 (find_package)
-- Found MPI_C: C:/Program Files (x86)/Intel/oneAPI/mpi/latest/lib/release/impi.lib
-- Found MPI: TRUE
-- Configuring incomplete, errors occurred!
See also "C:/temp/build/CMakeFiles/CMakeOutput.log".
See also "C:/temp/build/CMakeFiles/CMakeError.log".