# Source Files Path in Executable

**URL:** https://discourse.cmake.org/t/source-files-path-in-executable/10119
**Category:** Usage
**Tags:** gen:makefiles
**Created:** [February 16, 2024, 10:54pm UTC](https://discourse.cmake.org/t/source-files-path-in-executable/10119 "2024-02-16T22:54:59Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![bhvima](https://discourse.cmake.org/user_avatar/discourse.cmake.org/bhvima/32/4319_2.png) [@bhvima](https://discourse.cmake.org/u/bhvima)
#### Post date: [February 16, 2024, 10:54pm UTC](https://discourse.cmake.org/t/source-files-path-in-executable/10119/1 "2024-02-16T22:54:59Z")

</div>

I am using CMake to build a large project. The source directory is `/home/user/project` and the build directory is `/home/user/project/build/linux`.

In the final executable generated when I look at the `DW_AT_name` it is `/home/user/project/app/src/app.cpp` and the `DW_AT_comp_dir` is `/home/user/project/build/linux/app/`.

Debuggers look for source files at `DW_AT_comp_dir/DW_AT_name` which results in the incorrect path `/home/user/project/build/linux/app//home/user/project/app/src/app.cpp`

How to fix this issue?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [February 18, 2024, 3:37am UTC](https://discourse.cmake.org/t/source-files-path-in-executable/10119/2 "2024-02-18T03:37:36Z")

</div>

AFAIK, CMake provides no abstraction for this. Can you reproduce it with a small example project?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [February 18, 2024, 3:44am UTC](https://discourse.cmake.org/t/source-files-path-in-executable/10119/3 "2024-02-18T03:44:44Z")

</div>

Ah, I see [Incorrect Source File Paths](https://discourse.cmake.org/t/incorrect-source-file-paths/10123) now.

Closing this one.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [February 18, 2024, 3:44am UTC](https://discourse.cmake.org/t/source-files-path-in-executable/10119/4 "2024-02-18T03:44:47Z")

</div>


