I’ll try to explain my confusing problem (any expert in SPM and compilers around?):
- We ship a pre-compiled static framework (
MyFramework
) through SPM. - A customer has its own package (
CustomerPackage
) with many targets that are used by their app project. These targets depend onMyFramework
. - In their app project, they have a couple of dynamic frameworks (
ModuleA
,ModuleB
). These frameworks haveCustomerPackage
as a dependency and are then loaded by the app.
MyFramework
’s definition gets duplicated in the app with the warning “ClassX is defined in both ModuleA and ModuleB.”
However, other targets of CustomerPackage
that are not pre-compiled targets don’t get duplicated in ModuleA
and ModuleB
. What magic is happening here, AFAIK, the default linking mode of a Package target is also static.
Can I configure MyFramework
’s Package.swift in a way to solve this problem (other than changing it to .dynamic
)?