Remove the inner dependency when linked into the final target.

Hello, I want to build a shared library as follow on windows with VS generator:

add_library(A STATIC a.cpp)
add_library(B STATIC b.cpp)
target_link_libraries(B PRIVATE A)

add_library(Dyn SHARED 
    xx
    $<TARGET_OBJECTS:A>)

target_link_libraries(Dyn PRIVATE B)

when building Dyn library, there is a error that said a duplicate function(such as FuncA) in both a.obj and a.lib, the link was ‘lld-link … a.obj a.lib’.
Because Dyn needs to export the functions in A, so I added $<TARGET_OBJECTS:A>, and some other libaries need to link A, so I build A as a static library.

I modify the interface_link_libraries option of target B, and the error was gone, but other errors occurred, which said FuncA is not difined in other libraries that links to B, because other libraries did not link to A.

Therefore, I thought the only way to solve this problem is modify the options in target Dyn. Then I modified the interface_link_libraries option of target B before target_link_libraries(Dyn PRIVATE B) and restore B’s interface_link_libraries option after call target_link_libraries(Dyn PRIVATE B), but it did not work, because cmake generated the VS project after these operations.

So is there any option to directly change Dyn target’s option so that the link line of Dyn target do not include a.lib? Thanks