My question is simple (NOTE: Not sure it matters a lot but I am compiling against emscripten hence using emcmake and emmake)
So basically I have 3 PROJECTS (A B C)
- I have libC.a
- For B I am doing
add_library(B STATIC
source files
)
# Specify include directories for this library’s headers (for propagation)
target_include_directories(B PUBLIC
source headers
)
target_link_libraries(B PUBLIC
C
)
Q1) Now my first question is about symbols. I guess I should be able to find symbols present in C in B too ?
nm libB.a | grep "symbol_from_C"
- Now when I am trying to build A that links with B
target_link_libraries(A PUBLIC B
Q2) Now here I run emcmake and emmake … which gives me an error saying I have undefined symbols. Now these symbols should technically be present in C and so I am curious if the dependency of C has not reached A through B ?
I am linking everything through PUBLIC, so not sure anything is wrong there. I’ve been using target_link_libraries etc since quite some time without understanding how these dependencies propoagate.
Also I first thought the link.txt for B would show us info on C too but that just has
emar qc libB.a xx.cpp.o (basically source object files)
/emranlib libB.a
So even this doesn’t show me info on C. I am really confused how these can be propagated ahead to A.