cmake_language(DEFER) - add option to run after generation ?

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 ?

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.