# cmake fileapi not catching add\_subdirectory calls in backtraceGraph

**URL:** https://discourse.cmake.org/t/cmake-fileapi-not-catching-add-subdirectory-calls-in-backtracegraph/7322
**Category:** Development
**Created:** [January 26, 2023, 1:58pm UTC](https://discourse.cmake.org/t/cmake-fileapi-not-catching-add-subdirectory-calls-in-backtracegraph/7322 "2023-01-26T13:58:22Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![vkhristenko](https://discourse.cmake.org/user_avatar/discourse.cmake.org/vkhristenko/32/2866_2.png) [@vkhristenko](https://discourse.cmake.org/u/vkhristenko)
#### Post date: [January 26, 2023, 1:58pm UTC](https://discourse.cmake.org/t/cmake-fileapi-not-catching-add-subdirectory-calls-in-backtracegraph/7322/1 "2023-01-26T13:58:22Z")

</div>

Hello,

I’m using fileapi codemodel and i"m wondering if there is a reason why add\_subdirectory calls are not reflected in backtraceGraph, when all other calls seem to be there? (e.g. add\_library, custom functions, target\_include\_directories, etc…)

As a follow up question, backtraceGraph for a target that is declared 2 levels below the main CMakeLists.txt (2 add\_subdirectory calls from CMakeLists.txt) does not contain the root CMakeLists.txt in its backtrace graph, is that expected behavior? if a target is declated 1 level below (1 add\_subdirectory call), it produces an expected backtraceGraph…

Any suggestions would be greatly appreciated!

VK

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [January 26, 2023, 2:35pm UTC](https://discourse.cmake.org/t/cmake-fileapi-not-catching-add-subdirectory-calls-in-backtracegraph/7322/2 "2023-01-26T14:35:58Z")

</div>

All CMake’s backtraces are rooted in a (sub)directory’s `CMakeLists.txt` and don’t go across directories.

For your 2-level v. 1-level case, please post a concrete code example.

---

<div class="post-metadata">

### Author: ![vkhristenko](https://discourse.cmake.org/user_avatar/discourse.cmake.org/vkhristenko/32/2866_2.png) [@vkhristenko](https://discourse.cmake.org/u/vkhristenko)
#### Post date: [January 30, 2023, 10:34am UTC](https://discourse.cmake.org/t/cmake-fileapi-not-catching-add-subdirectory-calls-in-backtracegraph/7322/3 "2023-01-30T10:34:12Z")

</div>

Hello,

Thanks for getting back to me so quickly! I think i will need to provide a reproducer properly…  
closing for now…

VK
