From 6c91cc1f767c3d9d62e8d38c3dce5016d8c739d9 Mon Sep 17 00:00:00 2001
From: Christoph Junghans <junghans@votca.org>
Date: Wed, 9 May 2018 23:12:00 -0600
Subject: [PATCH] cmake: rename ENABLE_MPI to BUILD_MPI

---
 cmake/CMakeLists.txt | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 1699058f60..213e27aece 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -61,8 +61,10 @@ include(GNUInstallDirs)
 set(LAMMPS_LINK_LIBS)
 set(LAMMPS_DEPS)
 set(LAMMPS_API_DEFINES)
-option(ENABLE_MPI "Build MPI version" OFF)
-if(ENABLE_MPI)
+
+find_package(MPI QUIET)
+option(BUILD_MPI "Build MPI version" ${MPI_FOUND})
+if(BUILD_MPI)
   find_package(MPI REQUIRED)
   include_directories(${MPI_C_INCLUDE_PATH})
   list(APPEND LAMMPS_LINK_LIBS ${MPI_CXX_LIBRARIES})
@@ -763,6 +765,6 @@ else()
   message(STATUS "Static libraries  ${CMAKE_STATIC_LINKER_FLAGS}")
 endif()
 message(STATUS "Link libraries: ${LAMMPS_LINK_LIBS}")
-if(ENABLE_MPI)
+if(BUILD_MPI)
   message(STATUS "Using mpi with headers in ${MPI_C_INCLUDE_PATH} and ${MPI_CXX_LIBRARIES}")
 endif()
-- 
GitLab