# Source doesn't exist yet for target depending on custom target using source generated by add\_custom\_command

**URL:** https://discourse.cmake.org/t/source-doesnt-exist-yet-for-target-depending-on-custom-target-using-source-generated-by-add-custom-command/1218
**Category:** Code
**Tags:** os:linux
**Created:** [May 14, 2020, 5:47pm UTC](https://discourse.cmake.org/t/source-doesnt-exist-yet-for-target-depending-on-custom-target-using-source-generated-by-add-custom-command/1218 "2020-05-14T17:47:10Z")
**Posts on this page:** 1
**Showing post:** 2

<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: [November 9, 2020, 7:53pm UTC](https://discourse.cmake.org/t/source-doesnt-exist-yet-for-target-depending-on-custom-target-using-source-generated-by-add-custom-command/1218/2 "2020-11-09T19:53:48Z")

</div>

Scope visibility between `add_custom_command` and targets can be a bit weird. I’d recommend moving the `add_custom_command` calls to be beside the target (not made by `add_custom_target`) that will use them.

[This discussion](https://discourse.cmake.org/t/automatically-detecting-generated-dependencies/1183) has some relevant details for that.

---

_[View the full topic](https://discourse.cmake.org/t/source-doesnt-exist-yet-for-target-depending-on-custom-target-using-source-generated-by-add-custom-command/1218)._
