From: Matthias Maier Date: Fri, 12 Jan 2018 21:31:14 +0000 (-0600) Subject: CMake: Support a FindMPI.cmake of CMake version 3.10 and later X-Git-Tag: v9.0.0-rc1~570^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8b177027563f7756bc164832e9c92b19ab59d473;p=dealii.git 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.) --- 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