Skip to content

Commit

Permalink
only check MPI-3 Fortran if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Dec 21, 2023
1 parent 862b1cb commit 6d11a95
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cmake/mpi.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ include(${CMAKE_CURRENT_LIST_DIR}/openmpi.cmake)

set(CMAKE_REQUIRED_LIBRARIES MPI::MPI_Fortran)

if(MPI_Fortran_HAVE_F08_MODULE)
return()
endif()

# sometimes factory FindMPI.cmake doesn't define this
message(CHECK_START "Checking for Fortran MPI-3 binding")
check_source_compiles(Fortran
[=[
program test
Expand All @@ -32,6 +37,9 @@ end program
MPI_Fortran_HAVE_F08_MODULE
)

if(NOT MPI_Fortran_HAVE_F08_MODULE)
message(FATAL_ERROR "Fortran MPI-3 binding not present.")
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()

0 comments on commit 6d11a95

Please sign in to comment.