# Doubt regarding propagation of dependencies for static libraries

**URL:** https://discourse.cmake.org/t/doubt-regarding-propagation-of-dependencies-for-static-libraries/12872
**Category:** Usage
**Created:** [October 31, 2024, 1:05pm UTC](https://discourse.cmake.org/t/doubt-regarding-propagation-of-dependencies-for-static-libraries/12872 "2024-10-31T13:05:43Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![anutosh491](https://discourse.cmake.org/user_avatar/discourse.cmake.org/anutosh491/32/5064_2.png) [@anutosh491](https://discourse.cmake.org/u/anutosh491)
#### Post date: [October 31, 2024, 1:05pm UTC](https://discourse.cmake.org/t/doubt-regarding-propagation-of-dependencies-for-static-libraries/12872/1 "2024-10-31T13:05:43Z")

</div>

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)

1. I have libC.a
2. For B I am doing

```auto
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 ?

```auto
nm libB.a | grep "symbol_from_C"

```

1. Now when I am trying to build A that links with B

```auto
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

```auto
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.
