# How to get output name that will be generated by a Target?

**URL:** https://discourse.cmake.org/t/how-to-get-output-name-that-will-be-generated-by-a-target/5159
**Category:** Usage
**Created:** [March 4, 2022, 5:13pm UTC](https://discourse.cmake.org/t/how-to-get-output-name-that-will-be-generated-by-a-target/5159 "2022-03-04T17:13:21Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![fabiop](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/f/8e7dd6/32.png) [@fabiop](https://discourse.cmake.org/u/fabiop)
#### Post date: [March 4, 2022, 5:13pm UTC](https://discourse.cmake.org/t/how-to-get-output-name-that-will-be-generated-by-a-target/5159/1 "2022-03-04T17:13:21Z")

</div>

I want to get the path on disk of the artefact that will be produced by a target. I am using get\_target\_property() with OUTPUT\_NAME property but this does not work. Reading the documentation it seems that this is a property which is set by the user. So this does not work because i want to get the default value that CMake uses if OUTPUT\_NAME is not set.  
Thanks in advance for any help

---

<div class="post-metadata">

### Author: ![fenrir](https://discourse.cmake.org/user_avatar/discourse.cmake.org/fenrir/32/734_2.png) [@fenrir](https://discourse.cmake.org/u/fenrir)
#### Post date: [March 4, 2022, 5:40pm UTC](https://discourse.cmake.org/t/how-to-get-output-name-that-will-be-generated-by-a-target/5159/2 "2022-03-04T17:40:09Z")

</div>

AFAIK this is only possible at generation step, so you’d have to use something from here: [https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html#target-dependent-queries](https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html#target-dependent-queries) I suppose.

---

<div class="post-metadata">

### Author: ![fabiop](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/f/8e7dd6/32.png) [@fabiop](https://discourse.cmake.org/u/fabiop)
#### Post date: [March 4, 2022, 5:41pm UTC](https://discourse.cmake.org/t/how-to-get-output-name-that-will-be-generated-by-a-target/5159/3 "2022-03-04T17:41:28Z")

</div>

I need it at configure step

---

<div class="post-metadata">

### Author: ![hsattler](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/h/59ef9b/32.png) [@hsattler](https://discourse.cmake.org/u/hsattler)
#### Post date: [March 4, 2022, 6:19pm UTC](https://discourse.cmake.org/t/how-to-get-output-name-that-will-be-generated-by-a-target/5159/4 "2022-03-04T18:19:00Z")

</div>

Maybe you can tell the problem you are trying to solve?

---

<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: [March 4, 2022, 8:41pm UTC](https://discourse.cmake.org/t/how-to-get-output-name-that-will-be-generated-by-a-target/5159/5 "2022-03-04T20:41:17Z")

</div>

> [@fabiop](#):
>
> I need it at configure step

This doesn’t work in general because the `OUTPUT_NAME` could change after you query it. This is why it is, fundamentally, a generate-time thing. Knowing _why_ you want to know this is likely to be more enlightening.
