-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
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.