diff --git a/rules_fortran/defs.bzl b/rules_fortran/defs.bzl index 64ecefe..f4b8f39 100644 --- a/rules_fortran/defs.bzl +++ b/rules_fortran/defs.bzl @@ -103,6 +103,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 @@ -144,6 +161,23 @@ def _fortran_library_impl(ctx): archive = depset([output]), includes = ctx.files.includes, ), + 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(