diff --git a/src/fpm_meta.f90 b/src/fpm_meta.f90 index 98468270cc..b917c8d9e9 100644 --- a/src/fpm_meta.f90 +++ b/src/fpm_meta.f90 @@ -1098,8 +1098,8 @@ subroutine mpi_compiler_match(language,wrappers,compiler,which_one,mpilib,error) ! Because the intel mpi library does not support llvm_ compiler wrappers yet, ! we must check for that manually if (mpi_compiler%is_intel() .and. compiler%is_intel()) then - which_one = i - return + same_vendor = i + vendor_mpilib = mpilib end if case (LANG_C) @@ -1111,9 +1111,9 @@ subroutine mpi_compiler_match(language,wrappers,compiler,which_one,mpilib,error) ! Because the intel mpi library does not support llvm_ compiler wrappers yet, ! we must check for that manually - if (screen%s='icc' .and. compiler%cc=='icx') then - which_one = i - return + if (screen%s=='icc' .and. compiler%cc=='icx') then + same_vendor = i + vendor_mpilib = mpilib end if case (LANG_CXX) @@ -1124,15 +1124,21 @@ subroutine mpi_compiler_match(language,wrappers,compiler,which_one,mpilib,error) ! Because the intel mpi library does not support llvm_ compiler wrappers yet, ! we must check for that manually - if (screen%s='icpc' .and. compiler%cc=='icpx') then - which_one = i - return + if (screen%s=='icpc' .and. compiler%cc=='icpx') then + same_vendor = i + vendor_mpilib = mpilib end if end select end do + ! Intel compiler: if an exact match is not found, attempt closest wrapper + if (which_one==0 .and. same_vendor>0) then + which_one = same_vendor + mpilib = vendor_mpilib + end if + ! None of the available wrappers matched the current Fortran compiler write(msg_out,1) size(wrappers),compiler%fc call fatal_error(error,trim(msg_out))