FindMPI: New compiler wrapper parsing logic
This MR replaces the previous, generic parsing logic with a new one based entirely CMake platform variables. After all, CMake knows for a given compiler how
-I look like and we can consume these.
Currently, it is possible to have erroneous matches of flags, especially due to the inclusion of
/I for Visual C++, which would match on other platforms parameters like
-L /Data/my/path causing
ata/my/path to be considered a definition and due to the space would not even be parsed as a path.
In the same way, the current system fails to remove linker paths given by
-Wl,-L/my/path from the linker flags array, which has been improved.
Overall this currently addresses:
- Support for Visual C++ style
/linkparameter separation and linker flags on this compiler.
- Full dynamization of flags and library prefixes/suffixes due to elevating CMake's own mechanics. This adds support for direct paths to
- Significantly simplified regexes causing a reduction in false matches.
- Support for more exotic syntaxes like
-Wl,--library-path=/my/pathfor maximal compatibility.
- Elimination of linker path flags parameters from the link flags output variable.
- Retain linker directories that weren't used for finding libraries.
- Add MPICH and Intel MPI compiler environment variables to improve search quality by matching the compiler for the wrapper. This ensures compiler-specific configuration files are parsed correctly.
- Intel MPI:
I_MPI_FORT_BINDto disabled if they weren't set. Neither makes sense for CMake - the first one we need to explicitly ignore during the parse of the static link information, and the latter one is intended to ease linking mixed C/C++ and Fortran applications by also providing the Fortran dependencies when using the wrapper. For CMake this makes little sense to use, as it wouldn't be portable anyways and it causes C++ apps to depend on Fortran MPI runtimes by default.
I_MPI_CHECK_COMPILERcompiler checking. This triggers some limited compiler compatibility checks with the MPI. Only Intel and GCC compilers are supported by it. Previously setting this variable or passing
-compchkwould have broken the parsing.