may check for MPI library Fortran support only if MPI is enabled

This commit is contained in:
Axel Kohlmeyer
2022-06-23 15:54:04 -04:00
parent ae18e1e01c
commit cf942e7d5f

View File

@ -10,11 +10,6 @@ if(NOT CMAKE_Fortran_COMPILER_ID)
message(STATUS "Skipping Tests for the LAMMPS Fortran Module: cannot identify Fortran compiler")
return()
endif()
find_package(MPI QUIET)
if(BUILD_MPI AND NOT MPI_Fortran)
message(STATUS "Skipping Tests for the LAMMPS Fortran Module: no MPI support for Fortran")
return()
endif()
if(CMAKE_Fortran_COMPILER)
enable_language(C)
@ -22,6 +17,10 @@ if(CMAKE_Fortran_COMPILER)
get_filename_component(LAMMPS_FORTRAN_MODULE ${LAMMPS_SOURCE_DIR}/../fortran/lammps.f90 ABSOLUTE)
if(BUILD_MPI)
find_package(MPI REQUIRED)
if((NOT MPI_Fortran) OR (NOT MPI_Fortran_HAVE_F77_HEADER) OR (NOT MPI_Fortran_HAVE_F90_MODULE))
message(STATUS "Skipping Tests for the LAMMPS Fortran Module: no MPI support for Fortran")
return()
endif()
else()
add_library(fmpi_stubs STATIC mpi_stubs.f90)
add_library(MPI::MPI_Fortran ALIAS fmpi_stubs)