Circular dependency, weak symbols


I need to solve problem with linking firmware. Because of circuar dependencies in my code I’m forced to create static libraries. I had to increase the LINK_INTERFACE_MULTIPLICITY to 3 otherwise build fails with unresolved symbols.
At the same time I need to overload some symbols in GCC libraries. Probably because how the list of archives is constructed by CMAKE, the symbols from GCC libraries take precedence.

Normally I would just compile the libs into object files, and link all static libraries in one group. But with cmake it seems to be imposible. First because cmake requires static libraries and second group enforcement only works for direct dependencies.

Is there a way to:

  1. disable link multiplicity? - then I could just modify the link command and enclose all libs into group
  2. disable requirement for static libraries in case of circular dependencies - then I could define “strong” libraries as objects.
  3. get list of all libraries required for a target? - to create custom link command for the target.

Or other way to solve it?

See this issue.