From: Matthias Maier Date: Mon, 1 Jan 2018 19:30:05 +0000 (-0600) Subject: CMake: remove mpi two-pass search X-Git-Tag: v9.0.0-rc1~570^2~4 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=da1ce61fa7c4b92f3d86c10de90c29ac14d8eb81;p=dealii.git CMake: remove mpi two-pass search As discussed in https://github.com/dealii/dealii/issues/5510, we must not assume anything about the internal workings of CMake's FindMPI.cmake module. In particular, it is not sufficient to set CMAKE__COMPILER to an MPI-compiler wrapper in order for FindMPI.cmake to actually detect MPI. So, remove this logic in our FindMPI.cmake module. --- diff --git a/cmake/modules/FindMPI.cmake b/cmake/modules/FindMPI.cmake index 1c74da93b2..863dc66a4a 100644 --- a/cmake/modules/FindMPI.cmake +++ b/cmake/modules/FindMPI.cmake @@ -37,35 +37,13 @@ IF(MPI_CXX_FOUND) SET(MPI_FOUND TRUE) ENDIF() -# -# If CMAKE_CXX_COMPILER is already an MPI wrapper, use it to determine -# the mpi implementation. If MPI_CXX_COMPILER is defined use the value -# directly. -# -SET_IF_EMPTY(MPI_CXX_COMPILER ${CMAKE_CXX_COMPILER}) -IF(CMAKE_C_COMPILER_WORKS) - SET_IF_EMPTY(MPI_C_COMPILER ${CMAKE_C_COMPILER}) # for good measure -ELSE() - MESSAGE(STATUS - "No suitable C compiler was found! MPI C interface can not be " - "autodetected" - ) -ENDIF() -IF(CMAKE_Fortran_COMPILER_WORKS) - SET_IF_EMPTY(MPI_Fortran_COMPILER ${CMAKE_Fortran_COMPILER}) # for good measure -ELSE() - MESSAGE(STATUS - "No suitable Fortran compiler was found! MPI Fortran interface can " - "not be autodetected" - ) -ENDIF() - # # Call the system FindMPI.cmake module: # -# in case MPIEXEC is specified first call find_program() so that in case of success -# its subsequent runs inside FIND_PACKAGE(MPI) do not alter the desired result. +# in case MPIEXEC is specified first call find_program() so that in case of +# success its subsequent runs inside FIND_PACKAGE(MPI) do not alter the +# desired result. IF(DEFINED ENV{MPIEXEC}) FIND_PROGRAM(MPIEXEC $ENV{MPIEXEC}) ENDIF() @@ -73,27 +51,6 @@ ENDIF() # temporarily disable ${CMAKE_SOURCE_DIR}/cmake/modules for module lookup LIST(REMOVE_ITEM CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules/) FIND_PACKAGE(MPI) - -IF(NOT MPI_CXX_FOUND AND DEAL_II_WITH_MPI) - # - # CMAKE_CXX_COMPILER is apparently not an mpi wrapper. - # So, let's be a bit more aggressive in finding MPI (and if - # DEAL_II_WITH_MPI is set). - # - MESSAGE(STATUS - "MPI not found but DEAL_II_WITH_MPI is set to TRUE." - " Try again with more aggressive search paths:" - ) - # Clear variables so that FIND_PACKAGE runs again: - SET(MPI_FOUND) - SET(MPI_CXX_COMPILER) - SET(MPI_C_COMPILER) - SET(MPI_Fortran_COMPILER) - UNSET(MPI_CXX_COMPILER CACHE) - UNSET(MPI_C_COMPILER CACHE) - UNSET(MPI_Fortran_COMPILER CACHE) - FIND_PACKAGE(MPI) -ENDIF() LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules/) #