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()