From 8b177027563f7756bc164832e9c92b19ab59d473 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Fri, 12 Jan 2018 15:31:14 -0600 Subject: [PATCH] CMake: Support a FindMPI.cmake of CMake version 3.10 and later This change should also be backward compatible to older CMake versions. (Fingers crossed.) --- cmake/macros/macro_deal_ii_package_handle.cmake | 9 ++++++++- cmake/modules/FindMPI.cmake | 9 +++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/cmake/macros/macro_deal_ii_package_handle.cmake b/cmake/macros/macro_deal_ii_package_handle.cmake index bedef00f0d..be6ff875f3 100644 --- a/cmake/macros/macro_deal_ii_package_handle.cmake +++ b/cmake/macros/macro_deal_ii_package_handle.cmake @@ -51,7 +51,14 @@ MACRO(DEAL_II_PACKAGE_HANDLE _feature _var) MESSAGE(STATUS " ${_feature}_VERSION: ${${_feature}_VERSION}") ENDIF() - SET(${_feature}_FOUND TRUE) + # + # Respect a possible ${_feature}_FOUND variable that is set to a truth + # value. We need this for modern™ MPI detection where CMake's + # FindMPI.cmake might only set MPI_FOUND to true and nothing else. + # + IF(NOT DEFINED ${_feature}_FOUND) + SET(${_feature}_FOUND TRUE) + ENDIF() SET(_variable ${_var}) SET(${_feature}_${_variable} "") diff --git a/cmake/modules/FindMPI.cmake b/cmake/modules/FindMPI.cmake index 863dc66a4a..ec229c1f48 100644 --- a/cmake/modules/FindMPI.cmake +++ b/cmake/modules/FindMPI.cmake @@ -130,14 +130,11 @@ ENDIF() DEAL_II_PACKAGE_HANDLE(MPI LIBRARIES - REQUIRED MPI_CXX_LIBRARIES - OPTIONAL MPI_Fortran_LIBRARIES MPI_C_LIBRARIES + OPTIONAL MPI_CXX_LIBRARIES MPI_Fortran_LIBRARIES MPI_C_LIBRARIES INCLUDE_DIRS - REQUIRED MPI_CXX_INCLUDE_PATH - OPTIONAL MPI_C_INCLUDE_PATH + OPTIONAL MPI_CXX_INCLUDE_PATH MPI_C_INCLUDE_PATH USER_INCLUDE_DIRS - REQUIRED MPI_CXX_INCLUDE_PATH - OPTIONAL MPI_C_INCLUDE_PATH + OPTIONAL MPI_CXX_INCLUDE_PATH MPI_C_INCLUDE_PATH CXX_FLAGS OPTIONAL MPI_CXX_COMPILE_FLAGS LINKER_FLAGS OPTIONAL MPI_CXX_LINK_FLAGS CLEAR -- 2.39.5