From 7a97b25c8d3dfe783d806a7ca1d41b7b9d92eb38 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 12 Sep 2022 17:02:06 -0400 Subject: [PATCH] must link with -lgfortran when using flang --- unittest/fortran/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/unittest/fortran/CMakeLists.txt b/unittest/fortran/CMakeLists.txt index 1062766e43..c7174d8e6e 100644 --- a/unittest/fortran/CMakeLists.txt +++ b/unittest/fortran/CMakeLists.txt @@ -23,6 +23,10 @@ if(CMAKE_Fortran_COMPILER) endif() else() add_library(fmpi_stubs STATIC mpi_stubs.f90) + get_filename_component(_tmp_fc ${CMAKE_Fortran_COMPILER} NAME) + if (_tmp_fc STREQUAL "flang") + target_link_libraries(fmpi_stubs PUBLIC gfortran) + endif() add_library(MPI::MPI_Fortran ALIAS fmpi_stubs) endif()