I am importing three static libraries (A.a, B.a, C.a) with C depends on A and B, B depends on A. In my program I use functions in C.
(Ubuntu 16.04 and CMake 3.5.1) In my cmake file I use target_link_libraries() to link A.a, B.a, C.a with ordered to my executable file. However when compiling it shows "undefined reference to funcA()", where funA is Undefined Symbol in C.a (showed with nm command), this function is actually defined in A.a as a Text Symbol.
target_link_libraries(myExec A.a B.a C.a)
I expect to see linking static libraries correctly without those undefined symbol.
Update As Mike mentioned in the comment:
a library must be appear in the linkage sequence before those that it depends on
Therefore,
target_link_libraries(myExec C.a B.a A.a)
is the correct order