]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: remove mpi two-pass search
authorMatthias Maier <tamiko@43-1.org>
Mon, 1 Jan 2018 19:30:05 +0000 (13:30 -0600)
committerMatthias Maier <tamiko@43-1.org>
Fri, 12 Jan 2018 21:14:05 +0000 (15:14 -0600)
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_<LANG>_COMPILER
to an MPI-compiler wrapper in order for FindMPI.cmake to actually detect
MPI. So, remove this logic in our FindMPI.cmake module.

cmake/modules/FindMPI.cmake

index 1c74da93b2a48e82d0e654672e1132753a070ae9..863dc66a4a12e08a46121726a45c0fdd9818e5e7 100644 (file)
@@ -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/)
 
 #

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.