Skip to content
This repository was archived by the owner on Apr 8, 2021. It is now read-only.

Commit f4cab5c

Browse files
committed
external/PETSc: add MPI settings for Fortran language
On some distributions (i.e. OpenSUSE) MPI Fortran library is needed for compiling PETSc.
1 parent fc5c768 commit f4cab5c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

external/PETSc/cmake/FindPETSc.cmake

+19
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,25 @@ int main(int argc,char *argv[]) {
322322
list (APPEND libraries_all "${MPI_CXX_LIBRARIES}")
323323
endif()
324324

325+
get_property (_enabled_langs GLOBAL PROPERTY ENABLED_LANGUAGES)
326+
list (FIND _enabled_langs "Fortran" _fortran_lang_index)
327+
if (${_fortran_lang_index} GREATER -1)
328+
if(MPI_Fortran_DEFINITIONS)
329+
set(definitions_all "${definitions_all} ${MPI_Fortran_DEFINITIONS}")
330+
endif()
331+
332+
if(MPI_Fortran_COMPILE_OPTIONS)
333+
set(flags_all "${flags_all} ${MPI_Fortran_COMPILE_OPTIONS}")
334+
endif()
335+
336+
if(MPI_Fortran_LINK_FLAGS)
337+
set(flags_all "${flags_all} ${MPI_Fortran_LINK_FLAGS}")
338+
endif()
339+
340+
list (APPEND libraries_all "${MPI_Fortran_LIBRARIES}")
341+
endif()
342+
endif()
343+
325344
multipass_source_runs ("${includes_all}" "${libraries_all}" "${flags_all}" "${definitions_all}" "${_PETSC_TEST_SOURCE}" ${runs} "${PETSC_LANGUAGE_BINDINGS}")
326345
if (${${runs}})
327346
set (PETSC_EXECUTABLE_RUNS "YES" CACHE BOOL

0 commit comments

Comments
 (0)