cmake fails with broken MPI and MPI disabled
Summary
If the user runs cmake on a system with broken MPI installation, GROMACS fails to configure even though MPI isn't required.
GROMACS version
release-2023
Steps to reproduce
Run cmake with invalid path returned by mpicc -showme
.
What is the current bug behavior?
CMake Error in /iusers2/againull/imm_cmdlist_gromacs/gromacs/build/CMakeFiles/CMakeScratch/TryCompile-Dc3ua1/CMakeLists.txt:
Imported target "MPI::MPI_C" includes non-existent path
"/rdrive/ref/mpi/lin/2021.5.1.515/include"
in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:
* The path was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and references files it does not
provide.
CMake Error at /iusers2/againull/cmake/cmake-3.25.1-linux-x86_64/share/cmake-3.25/Modules/FindMPI.cmake:1271 (try_compile):
Failed to generate test project build system.
Call Stack (most recent call first):
/iusers2/againull/cmake/cmake-3.25.1-linux-x86_64/share/cmake-3.25/Modules/FindMPI.cmake:1322 (_MPI_try_staged_settings)
/iusers2/againull/cmake/cmake-3.25.1-linux-x86_64/share/cmake-3.25/Modules/FindMPI.cmake:1645 (_MPI_check_lang_works)
cmake/gmxManageMPI.cmake:65 (find_package)
CMakeLists.txt:501 (include)
What did you expect the correct behavior to be?
No error.
Possible fixes
- Revert 25a7a52b
- Wait for https://gitlab.kitware.com/cmake/cmake/-/issues/18196 to be fixed. Potentially document that
-DCMAKE_DISABLE_FIND_PACKAGE_MPI=on
can be used as work-around.
Edited by Roland Schulz