Skip to content

Commit 24fb5c1

Browse files
committed
try own FindMPI
1 parent 9cebb0e commit 24fb5c1

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ enable_testing()
88

99
message(STATUS "CMake ${CMAKE_VERSION} Generator ${CMAKE_GENERATOR}")
1010

11+
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
12+
1113
# this has checks that can be reused in other projects as well
1214
include(cmake/mpi.cmake)
1315

cmake/Modules/mpi/FindMPI.cmake renamed to cmake/Modules/FindMPI.cmake

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
FindMPI
66
-------
77
8-
by Michael Hirsch www.scivision.dev
8+
SciVision www.scivision.dev
99
1010
Finds compiler flags or library necessary to use MPI library (MPICH, OpenMPI, MS-MPI, Intel MPI, ...)
1111
@@ -30,12 +30,6 @@ Result Variables
3030
``MPI_FOUND``
3131
indicates MPI library found
3232
33-
``MPI_LIBRARIES``
34-
MPI library path
35-
36-
``MPI_INCLUDE_DIRS``
37-
MPI include path
38-
3933
``MPI_<LANG>_LIBRARIES``
4034
libraries for <LANG>
4135
@@ -257,6 +251,7 @@ list(APPEND MPI_C_LIBRARY ${MPI_C_LIBRARY_fullpath})
257251
find_path(MPI_C_INCLUDE_DIR
258252
NAMES mpi.h
259253
HINTS ${inc_dirs} ${mpi_root} ${pc_mpi_c_INCLUDE_DIRS} ${_hints} ${_hints_inc}
254+
DOC "MPI C include directory"
260255
)
261256
if(NOT (MPI_C_LIBRARY AND MPI_C_INCLUDE_DIR))
262257
return()
@@ -397,6 +392,7 @@ foreach(n ${mpi_libname})
397392
NAMES ${n}
398393
HINTS ${mpi_libdirs} ${mpi_root} ${pc_mpi_cxx_LIBRARY_DIRS} ${pc_mpi_cxx_LIBDIR} ${_hints}
399394
PATH_SUFFIXES ${mpi_libsuf}
395+
DOC "MPI C++ library"
400396
)
401397
if(MPI_CXX_${n}_LIBRARY)
402398
list(APPEND MPI_CXX_LIBRARY ${MPI_CXX_${n}_LIBRARY})
@@ -406,6 +402,7 @@ endforeach()
406402
find_path(MPI_CXX_INCLUDE_DIR
407403
NAMES mpi.h
408404
HINTS ${inc_dirs} ${mpi_root} ${pc_mpi_cxx_INCLUDE_DIRS} ${_hints} ${_hints_inc}
405+
DOC "MPI C++ include directory"
409406
)
410407
if(NOT (MPI_CXX_LIBRARY AND MPI_CXX_INCLUDE_DIR))
411408
return()
@@ -521,6 +518,7 @@ if(WIN32 AND NOT CMAKE_Fortran_COMPILER_ID MATCHES "^Intel")
521518
NAMES mpifptr.h
522519
HINTS ${inc_dirs} ${mpi_root} ${pc_mpi_f_INCLUDE_DIRS} ${_hints} ${_hints_inc}
523520
PATH_SUFFIXES x64
521+
DOC "MPI Fortran include directory"
524522
)
525523

526524
if(MPI_Fortran_INCLUDE_EXTRA AND NOT MPI_Fortran_INCLUDE_EXTRA STREQUAL ${MPI_Fortran_INCLUDE_DIR})
@@ -684,9 +682,6 @@ if(MPI_Fortran_FOUND)
684682
endif(MPI_Fortran_FOUND)
685683

686684
if(MPI_FOUND)
687-
set(MPI_LIBRARIES ${MPI_Fortran_LIBRARIES} ${MPI_C_LIBRARIES})
688-
set(MPI_INCLUDE_DIRS ${MPI_Fortran_INCLUDE_DIRS} ${MPI_C_INCLUDE_DIRS})
689-
690685
set(MPIEXEC_NUMPROC_FLAG "-n" CACHE STRING "Flag used by MPI to specify the number of processes for mpiexec; the next option will be the number of processes.")
691686
cmake_host_system_information(RESULT _n QUERY NUMBER_OF_PHYSICAL_CORES)
692687
set(MPIEXEC_MAX_NUMPROCS "${_n}" CACHE STRING "Maximum number of processors available to run MPI applications.")

0 commit comments

Comments
 (0)