# CMAKE\_CONFIGURE\_DEPENDS with newly created file

**URL:** https://discourse.cmake.org/t/cmake-configure-depends-with-newly-created-file/663
**Category:** Code
**Created:** [February 20, 2020, 10:02am UTC](https://discourse.cmake.org/t/cmake-configure-depends-with-newly-created-file/663 "2020-02-20T10:02:37Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Leherenn](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/l/ba9def/32.png) [@Leherenn](https://discourse.cmake.org/u/Leherenn)
#### Post date: [February 20, 2020, 10:02am UTC](https://discourse.cmake.org/t/cmake-configure-depends-with-newly-created-file/663/1 "2020-02-20T10:02:37Z")

</div>

I have some code that is auto generated externally using another script.  
Let’s say this generated in resources. In there, there is a “README.TXT” file with the generation timestamp, so the file changes every time the generation step is run.

I then have a CMake script include this auto generated code.  
If there is no auto generated code yet, there is a static fallback option.  
To ensure we always have the latest code, the following code has been added in the CMakeLists.txt:  
`set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS resources/README.TXT)`

If I already had auto generated code and I re-run the generation, at next build CMake reconfigures, all is well.  
If I remove the generated files, CMake re-run and the fallback files are used.  
However, if I have no generated files (resources and README.TXT do not exist) and I run the generation, then at next build CMake is not run.

Is that a known “limitation” of CMAKE\_CONFIGURE\_DEPENDS?  
The documentation only talks about modification to the file, but it is not clear if creating the file is a modification.  
If it is not possible using CMAKE\_CONFIGURE\_DEPENDS, what would be another way to do this?

---

<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 28, 2020, 7:40pm UTC](https://discourse.cmake.org/t/cmake-configure-depends-with-newly-created-file/663/2 "2020-02-28T19:40:51Z")

</div>

I feel like it would be more useful to have an `add_custom_command` which copies the resources into the right location based on whether the static files are more up-to-date. If you’re using `execute_process` to make them, converting _that_ to `add_custom_command` sounds like an even better solution. I don’t think trying to involve your configure step into your build is a wise decision since it feels like it’d be easy to end up with an infinite loop.
