diff --git a/CMakeLists.txt b/CMakeLists.txt index dc0f693980d6771d005c961cfae8f023ae81d174..4b010de5ab5cd8ddbd3b867b2d4e7d0ca1bece4b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -135,6 +135,10 @@ if(${MPI_FOUND}) message(FATAL_ERROR "MPI support requires ParMETIS which cannot be found!") endif() endif() +else() + if(PUGS_ENABLE_MPI MATCHES "^ON$") + message(FATAL_ERROR "Cannot find MPI!") + endif() endif() #------------------------------------------------------ @@ -144,6 +148,7 @@ set(PUGS_ENABLE_PETSC AUTO CACHE STRING "Choose one of: AUTO ON OFF") if (PUGS_ENABLE_PETSC MATCHES "^(AUTO|ON)$") + cmake_policy(SET CMP0075 OLD) find_package(PETSc) set(PUGS_HAS_PETSC ${PETSC_FOUND}) else() @@ -152,6 +157,10 @@ endif() if (${PETSC_FOUND}) include_directories(SYSTEM ${PETSC_INCLUDES}) +else() + if (PUGS_ENABLE_PETSC MATCHES "^ON$") + message(FATAL_ERROR "Could not find PETSc!") + endif() endif() diff --git a/packages/cmake-modules/FindPETSc.cmake b/packages/cmake-modules/FindPETSc.cmake index 41e02d9798c47f32ae57e7ecff2f544eb5256c1d..b6aa2ee422d644e668cfd9e7a98e790c4498e2d5 100644 --- a/packages/cmake-modules/FindPETSc.cmake +++ b/packages/cmake-modules/FindPETSc.cmake @@ -278,7 +278,14 @@ int main(int argc,char *argv[]) { return 0; } ") - multipass_source_runs ("${includes}" "${libraries}" "${_PETSC_TEST_SOURCE}" ${runs} "${PETSC_LANGUAGE_BINDINGS}") + multipass_source_runs( + "${includes} ${MPI_CXX_INCLUDE_DIRS} ${MPI_CXX_COMPILER_INCLUDE_DIRS}" + "${libraries}" + "${_PETSC_TEST_SOURCE}" + ${runs} + "${PETSC_LANGUAGE_BINDINGS}" + ) + if (${${runs}}) set (PETSC_EXECUTABLE_RUNS "YES" CACHE BOOL "Can the system successfully run a PETSc executable? This variable can be manually set to \"YES\" to force CMake to accept a given PETSc configuration, but this will almost always result in a broken build. If you change PETSC_DIR, PETSC_ARCH, or PETSC_CURRENT you would have to reset this variable." FORCE)