FindMPI: Workaround Intel MPI 5.0.1 exit code problem (#15182)

This MPI compiler may return zero even in some error cases.  Check the
output to catch such cases.

Suggested-by: Kelly Thompson <kgt@lanl.gov>
This commit is contained in:
Alin Marin Elena 2014-12-04 13:54:00 -05:00 committed by Brad King
parent f5ede30006
commit 7626c8dcf6
1 changed files with 6 additions and 0 deletions

View File

@ -194,6 +194,12 @@ function (_mpi_check_compiler compiler options cmdvar resvar)
OUTPUT_VARIABLE cmdline OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_VARIABLE cmdline ERROR_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE success)
# Intel MPI 5.0.1 will return a zero return code even when the
# argument to the MPI compiler wrapper is unknown. Attempt to
# catch this case.
if("${cmdline}" MATCHES "undefined reference")
set(success 255 )
endif()
set(${cmdvar} "${cmdline}" PARENT_SCOPE)
set(${resvar} "${success}" PARENT_SCOPE)
endfunction()