Ninja: MPICH2 and Intel MPI mpif90 breaks Fortran ABI check
CMake + Intel mpif90 + Ninja fails: ``` -- The Fortran compiler identification is Intel ... ... -- Detecting Fortran compiler ABI info - failed ``` The reason is as follows. With the Intel Fortran compiler and the Ninja generator, CMake explicitly preprocesses Fortran sources like this: ```console $ ifort -fpp -E src.F > src.F-pp.f ``` The redirection of stdout to a file is needed because `ifort`'s `-E` option is documented as "Causes the preprocessor to send output to stdout". There is no way to tell the compiler to write the preprocessor output directly to a file. Since !2716, first included in CMake 3.14, CMake passes the `-v` flag when compiling the ABI check in order to extract the implicit include directories that `ifort -v` prints to stderr. That causes the explicit preprocessing step to look like this: ```console $ ifort -fpp -v -E src.F > src.F-pp.f ``` CMake captures the `-v` output on stderr to extract the implicit include directories. However, this breaks when using Intel MPI's `mpif90`. It interprets the `-v` flag to mean two things: * Write version information to stdout. * Invoke the underlying `ifort` compiler with `-v`. The ABI check's explicit preprocessing step: ```console $ mpif90 -fpp -v -E src.F > src.F-pp.f ``` writes two lines of version of information into `src.F-pp.f`, which of course isn't valid Fortran syntax and doesn't compile. This can be seen by hand: ```console $ mpif90 -fpp -v -E empty.F 2>/dev/null mpif90 for the Intel(R) MPI Library ... Copyright(C) ..., Intel Corporation. All rights reserved. # 1 "empty.F" ```
issue