diff --git a/rules_fortran/defs.bzl b/rules_fortran/defs.bzl index e5ec298..caa146b 100644 --- a/rules_fortran/defs.bzl +++ b/rules_fortran/defs.bzl @@ -102,6 +102,23 @@ def _fortran_binary_impl(ctx): providers.append(OutputGroupInfo( dynamic_library = depset([output]), )) + providers.append(CcInfo( + linking_context = cc_common.create_linking_context( + linker_inputs = depset([ + cc_common.create_linker_input( + owner = ctx.label, + libraries = depset([ + cc_common.create_library_to_link( + actions = ctx.actions, + feature_configuration = feature_configuration, + cc_toolchain = fortran_toolchain, + dynamic_library = output, + ), + ]), + ), + ]), + ), + )) return providers @@ -141,6 +158,23 @@ def _fortran_library_impl(ctx): OutputGroupInfo( archive = depset([output]), ), + CcInfo( + linking_context = cc_common.create_linking_context( + linker_inputs = depset([ + cc_common.create_linker_input( + owner = ctx.label, + libraries = depset([ + cc_common.create_library_to_link( + actions = ctx.actions, + feature_configuration = feature_configuration, + cc_toolchain = fortran_toolchain, + static_library = output, + ), + ]), + ), + ]), + ), + ), ] fortran_library = rule(