Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-89047

Add transitive link flags option to mongo_cc_library

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Build
    • Fully Compatible

      Right now the link flags from the "linkopts" field are applied transitively on static builds, but non-transitively on dynamic builds.

      On dynamic builds we want the option to decide whether link flags should be applied transitively or non-transitively. There are certain link flags that should only be applied non-transitively like lib name flags that would result in hundreds or thousands of unnecessary flags if applied transitively.

      In other words, the current state is:

      Statically linked builds: linkopts flags are always applied transitively

      Dynamically linked builds: linkopts flags are never applied transitively

      We want to change this to:

      Statically linked builds: linkopts flags are always applied transitively

      Dynamically linked builds: linkopts are always transitive, non_transitive_dyn_linkopts are never applied transitively

      For an example of a compelling use case, see https://github.com/10gen/mongo/pull/20607 where a library wants to add another library to be linked by all targets that depend on the target. This requires transitive link opts in dynamic builds.

            Assignee:
            zack.winter@mongodb.com Zack Winter
            Reporter:
            zack.winter@mongodb.com Zack Winter
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: