Fully Understand the concept of target_link_libraries

I would like to fully understanding target_link_libraries .If I write

target_link_libraries( A B C )

In this case A(shared),B(static),C(shared) are libraries. I wonder:

1.What would the terminal command be in Ubuntu if I want to achieve same functionality?

2.What would system do for this statement, would system copy the content in B and C into A?

3.If I have to use A in other project, should I have to write target_link_libraries( A B C ) in that CMakeLists.txt once again even if something might happened when first time building A ?

This really depends on what the link usage requirements B and C are. But assuming they are static libraries with no transitive dependencies or link option requirements, it just adds the full paths to the .a files to the link line.

Generally, the sections which contain (transitively) used code would be copied over. Unused sections will not be copied (without other flags like --whole-archive).

If the A target is exported through CMake as a target, the usage requirements will follow it around. Though in the simplified case I assumed here, nothing else would be necessary (CMake or no), but this doesn’t hold if B or C are more complicated.