diff --git a/CMakeLists.txt b/CMakeLists.txt index e03717de42b86f3d425f7972ced78383a905e636..4f63552715b3cba73a7184d3064b7082118ecac5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -117,18 +117,24 @@ INCLUDE_DIRECTORIES( SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/gtest/include INCLUDE_DIRECTORIES( SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/quickcheck ) INCLUDE_DIRECTORIES( SYSTEM ${CMAKE_CURRENT_BINARY_DIR}/ThirdParty/zlib ) +# Use MPI +IF(OGS_USE_MPI) + IF(WIN32) + ADD_DEFINITIONS(/DUSE_MPI) + ELSE() + ADD_DEFINITIONS(-DUSE_MPI) + ENDIF() +ENDIF() + IF(OGS_USE_LIS) ADD_DEFINITIONS(-DUSE_LIS) INCLUDE_DIRECTORIES(SYSTEM ${LIS_INCLUDE_DIR}) ENDIF() +# Use PETSc package for global assembly and linear sover for parallel computing IF(OGS_USE_PETSC) ADD_DEFINITIONS(-DUSE_PETSC) - ADD_DEFINITIONS(-DUSE_MPI) -ENDIF() - -IF(OGS_USE_MPI) - ADD_DEFINITIONS(-DUSE_MPI) + SET(OGS_USE_MPI ON) ENDIF() IF(OGS_USE_EIGEN) diff --git a/scripts/cmake/Find.cmake b/scripts/cmake/Find.cmake index 9a68e213ed6e8cc884a672fa090bce9cbeb29a6f..b6cd99a30eba5f27b5b27da552dc5bd8b63dde6c 100644 --- a/scripts/cmake/Find.cmake +++ b/scripts/cmake/Find.cmake @@ -117,11 +117,8 @@ IF(OGS_USE_LIS) ENDIF() ## Check MPI package -IF(OGS_USE_PETSC OR OGS_USE_MPI) - FIND_PACKAGE(MPI) - IF(NOT MPI_FOUND) - MESSAGE(FATAL_ERROR "MPI is required but was not found!") - ENDIF() +IF(OGS_USE_MPI) + FIND_PACKAGE(MPI REQUIRED) ENDIF() IF(OGS_USE_PETSC)