Skip to content

Commit 6d11a95

Browse files
committed
only check MPI-3 Fortran if needed
1 parent 862b1cb commit 6d11a95

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

cmake/mpi.cmake

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ include(${CMAKE_CURRENT_LIST_DIR}/openmpi.cmake)
1919

2020
set(CMAKE_REQUIRED_LIBRARIES MPI::MPI_Fortran)
2121

22+
if(MPI_Fortran_HAVE_F08_MODULE)
23+
return()
24+
endif()
25+
2226
# sometimes factory FindMPI.cmake doesn't define this
27+
message(CHECK_START "Checking for Fortran MPI-3 binding")
2328
check_source_compiles(Fortran
2429
[=[
2530
program test
@@ -32,6 +37,9 @@ end program
3237
MPI_Fortran_HAVE_F08_MODULE
3338
)
3439

35-
if(NOT MPI_Fortran_HAVE_F08_MODULE)
36-
message(FATAL_ERROR "Fortran MPI-3 binding not present.")
40+
if(MPI_Fortran_HAVE_F08_MODULE)
41+
message(CHECK_PASS "yes")
42+
else()
43+
message(CHECK_FAIL "no")
44+
message(WARNING "MPI-3 Fortran module mpi_f08 not found, builds may fail.")
3745
endif()

0 commit comments

Comments
 (0)