# How to transform a list of relative paths into absolute paths using generator expressions?

**URL:** https://discourse.cmake.org/t/how-to-transform-a-list-of-relative-paths-into-absolute-paths-using-generator-expressions/12784
**Category:** Code
**Created:** [October 16, 2024, 7:32am UTC](https://discourse.cmake.org/t/how-to-transform-a-list-of-relative-paths-into-absolute-paths-using-generator-expressions/12784 "2024-10-16T07:32:46Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![petk](https://discourse.cmake.org/user_avatar/discourse.cmake.org/petk/32/4555_2.png) [@petk](https://discourse.cmake.org/u/petk)
#### Post date: [October 16, 2024, 7:32am UTC](https://discourse.cmake.org/t/how-to-transform-a-list-of-relative-paths-into-absolute-paths-using-generator-expressions/12784/1 "2024-10-16T07:32:46Z")

</div>

Is perhaps today already available some either hacky or recommended way to transform a list of paths to their absolute paths using generator expressions?

Because this would be needed in add\_custom\_command and similar cases when dealing with target sources. There were some feature requests opened a very long time ago but I’m not sure if there was some different solution added in the meantime: [https://gitlab.kitware.com/cmake/cmake/-/issues/19598](https://gitlab.kitware.com/cmake/cmake/-/issues/19598)

---

<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 16, 2024, 2:46pm UTC](https://discourse.cmake.org/t/how-to-transform-a-list-of-relative-paths-into-absolute-paths-using-generator-expressions/12784/2 "2024-10-16T14:46:43Z")

</div>

Did you try `$<PATH:ABSOLUTE_PATH[,NORMALIZE],path...,base_directory>` ?

---

<div class="post-metadata">

### Author: ![petk](https://discourse.cmake.org/user_avatar/discourse.cmake.org/petk/32/4555_2.png) [@petk](https://discourse.cmake.org/u/petk)
#### Post date: [October 16, 2024, 2:59pm UTC](https://discourse.cmake.org/t/how-to-transform-a-list-of-relative-paths-into-absolute-paths-using-generator-expressions/12784/3 "2024-10-16T14:59:45Z")

</div>

Wow! This now works also with a list of paths! Yes, this is it. Thank you so much. You saved the day. Then I think the above feature request could be closed.

---

<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 16, 2024, 3:08pm UTC](https://discourse.cmake.org/t/how-to-transform-a-list-of-relative-paths-into-absolute-paths-using-generator-expressions/12784/4 "2024-10-16T15:08:09Z")

</div>

Thank you too!  
It is the first time I resolve an issue on this board. 🙂
