forked from gemini3d/gemini3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmpi.cmake
More file actions
50 lines (41 loc) · 1.31 KB
/
Copy pathmpi.cmake
File metadata and controls
50 lines (41 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
include(CheckSourceCompiles)
if(NOT DEFINED MPI_ROOT AND DEFINED ENV{MPI_ROOT})
set(MPI_ROOT $ENV{MPI_ROOT})
endif()
if(MPI_ROOT)
message(STATUS "Using MPI_ROOT=${MPI_ROOT}")
else()
message(STATUS "MPI_ROOT not set, using default MPI search paths")
endif()
set(MPI_DETERMINE_LIBRARY_VERSION true)
find_package(MPI COMPONENTS C CXX Fortran REQUIRED)
message(STATUS "${MPI_Fortran_LIBRARY_VERSION_STRING}")
message(STATUS "MPI libs: ${MPI_Fortran_LIBRARIES}")
message(STATUS "MPI include: ${MPI_Fortran_INCLUDE_DIRS}")
message(STATUS "MPI compile flags: ${MPI_Fortran_COMPILER_FLAGS}")
message(STATUS "MPI link flags: ${MPI_Fortran_LINK_FLAGS}")
include(${CMAKE_CURRENT_LIST_DIR}/openmpi.cmake)
# --- MPI-3 detection
if(MPI_Fortran_HAVE_F08_MODULE)
return()
endif()
set(CMAKE_REQUIRED_LIBRARIES MPI::MPI_Fortran)
# sometimes factory FindMPI.cmake doesn't define this
message(CHECK_START "Checking for Fortran MPI-3 binding")
check_source_compiles(Fortran
[=[
program test
use mpi_f08, only : mpi_comm_rank, mpi_real, mpi_comm_world, mpi_init, mpi_finalize
implicit none
call mpi_init
call mpi_finalize
end program
]=]
MPI_Fortran_HAVE_F08_MODULE
)
if(MPI_Fortran_HAVE_F08_MODULE)
message(CHECK_PASS "yes")
else()
message(CHECK_FAIL "no")
message(WARNING "MPI-3 Fortran module mpi_f08 not found, builds may fail.")
endif()