For MPI builds, CMake will first try to compile a sample MPI program.
[alexxy/gromacs.git] / cmake / FindMPI.cmake
index 481b0e994dfa5d6c73c3a888444c90637a869a19..a0c36ed77af5dd34443a3886296d45098bffda5c 100644 (file)
 # Microsoft HPC SDK is automatically added to the system path
 # Argonne National Labs MPICH2 sets a registry key that we can use.
 
+TRY_COMPILE(MPI_FOUND ${CMAKE_BINARY_DIR}
+  "${CMAKE_SOURCE_DIR}/cmake/TestMPI.c"
+  COMPILE_DEFINITIONS )
+
+if(MPI_FOUND)
+  return()
+endif()
+
 set(_MPI_PACKAGE_DIR
   mpi
   mpich