Does target_link_libraries(... PRIVATE) deduplicate?

Since lib1 and lib2 are both static libraries, app should only end up with one copy of the code from lib2. It’s the linker’s job to resolve symbols needed by app’s object files. It will look through the lib1 and lib2 static libraries to resolve those symbols as needed. That’s a bit simplistic, but that’s the general idea.

1 Like