# cmake\_language(DEFER) - add option to run after generation ?

**URL:** https://discourse.cmake.org/t/cmake-language-defer-add-option-to-run-after-generation/15473
**Category:** Development
**Created:** [January 22, 2026, 7:37pm UTC](https://discourse.cmake.org/t/cmake-language-defer-add-option-to-run-after-generation/15473 "2026-01-22T19:37:35Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![neundorf](https://discourse.cmake.org/user_avatar/discourse.cmake.org/neundorf/32/2075_2.png) [@neundorf](https://discourse.cmake.org/u/neundorf)
#### Post date: [January 22, 2026, 7:37pm UTC](https://discourse.cmake.org/t/cmake-language-defer-add-option-to-run-after-generation/15473/1 "2026-01-22T19:37:35Z")

</div>

Hi,

with DEFER I can defer calls to the end of the configure step of a directory.

How about adding an option to defer code to the end of the generate step ?

This could be used to do postprocessing on files generated with generator expressions, since e.g. iterating is not really possible with generator expressions. One could e.g. generate a launch.vs.json and merge it properly with an potentially already existing and modified launch.vs.json.

What do you think ?

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [January 22, 2026, 8:10pm UTC](https://discourse.cmake.org/t/cmake-language-defer-add-option-to-run-after-generation/15473/2 "2026-01-22T20:10:22Z")

</div>

We’ve intentionally avoided adding any kind of post-generation hook because it can be abused to modify the results of generation, leading to treatment of the generated build system implementation details as a public interface.

Build-time custom commands can handle use cases like that in the description.
