# CMAKE\_CURRENT\_LIST\_DIR not working/understood ?

**URL:** https://discourse.cmake.org/t/cmake-current-list-dir-not-working-understood/12757
**Category:** Code
**Created:** [October 11, 2024, 7:32am UTC](https://discourse.cmake.org/t/cmake-current-list-dir-not-working-understood/12757 "2024-10-11T07:32:47Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Oodini](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/o/db5fbb/32.png) [@Oodini](https://discourse.cmake.org/u/Oodini)
#### Post date: [October 11, 2024, 7:32am UTC](https://discourse.cmake.org/t/cmake-current-list-dir-not-working-understood/12757/1 "2024-10-11T07:32:47Z")

</div>

Hello,

I have a CMakeLists.txt in DirA, calling a .cmake in DirB.  
When I ask for the value of `CMAKE_CURRENT_LIST_DIR` in the .cmake script, I expect it points to DirB. But its value is DirA.

According @brad.king , is it not supposed to return Dir B ?  
[https://gitlab.kitware.com/cmake/cmake/-/issues/18512](https://gitlab.kitware.com/cmake/cmake/-/issues/18512)

---

<div class="post-metadata">

### Author: ![scivision](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/a87d85/32.png) [@scivision](https://discourse.cmake.org/u/scivision)
#### Post date: [October 11, 2024, 12:13pm UTC](https://discourse.cmake.org/t/cmake-current-list-dir-not-working-understood/12757/2 "2024-10-11T12:13:50Z")

</div>

If it’s a function you need CMAKE\_CURRENT\_FUNCTION\_LIST\_DIR

---

<div class="post-metadata">

### Author: ![Oodini](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/o/db5fbb/32.png) [@Oodini](https://discourse.cmake.org/u/Oodini)
#### Post date: [October 11, 2024, 12:15pm UTC](https://discourse.cmake.org/t/cmake-current-list-dir-not-working-understood/12757/3 "2024-10-11T12:15:14Z")

</div>

Thank you !
