find_package fails for MPI in build directory with long absolute path (Linux)

On a Linux system with a build directory path longer than ~256 characters* find_package(MPI REQUIRED) is failing because missing: MPI_Fortran_WORKS. Is there something I can do to fix or diagnose what might be going wrong?

*In other words I’m running cmake .. from /very/long/path/to/build, where len('/very/long/path/to/build')>=254 is bad, but length 253 is fine.

This issue is caused by buggy Intel Fortran compilers (at least ifort 2021.6.0 is affected).

With that specific compiler version, the command ifort -I <mpi include> -c /very/long/path/test_mpi.f90 -o test_mpi.f90.o will fail to find valid MPI includes, causing the try_compile calls in FindMPI.cmake to fail.