From: Peter Muench Date: Sat, 23 Nov 2024 13:51:14 +0000 (+0100) Subject: Update the usage of MPIEXEC_EXECUTABLE/MPIEXEC X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe7e5f6044a48e03cf3412769780268aaff132cf;p=dealii.git Update the usage of MPIEXEC_EXECUTABLE/MPIEXEC --- diff --git a/cmake/modules/FindDEAL_II_MPI.cmake b/cmake/modules/FindDEAL_II_MPI.cmake index 8ad96111af..4e4bc249bd 100644 --- a/cmake/modules/FindDEAL_II_MPI.cmake +++ b/cmake/modules/FindDEAL_II_MPI.cmake @@ -41,11 +41,20 @@ endif() # Call the system FindMPI.cmake module: # -# in case MPIEXEC is specified first call find_program() so that in case of -# success its subsequent runs inside find_package(MPI) do not alter the -# desired result. -if(DEFINED ENV{MPIEXEC}) - find_program(MPIEXEC $ENV{MPIEXEC}) +# +# Make sure we pick up the correct MPI implementation for the case that +# environment variables MPIEXEC_EXECUTABLE, or MPIEXEC are set. If +# MPIEXEC_EXECUTABLE is already set as a CMake variable simply ignore the +# environment variables. +# +if(NOT MPIEXEC_EXECUTABLE) + if(DEFINED ENV{MPIEXEC_EXECUTABLE}) + find_program(MPIEXEC_EXECUTABLE $ENV{MPIEXEC_EXECUTABLE}) + elseif(DEFINED ENV{MPIEXEC}) + find_program(MPIEXEC_EXECUTABLE $ENV{MPIEXEC}) + endif() + # For backwards compatbility with old cmake versions: + set(MPIEXEC "${MPIEXEC_EXECUTABLE}") endif() find_package(MPI)