Browse Source

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 <[email protected]>
Alin Marin Elena 11 years ago
parent
commit
7626c8dcf6
1 changed files with 6 additions and 0 deletions
  1. 6 0
      Modules/FindMPI.cmake

+ 6 - 0
Modules/FindMPI.cmake

@@ -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()