[cmake-developers] Generating files at generate-time

Brad King brad.king at kitware.com
Thu May 2 12:59:50 EDT 2013


On 05/02/2013 11:07 AM, Stephen Kelly wrote:
> How do you generate a file only once with non-config-dependent content in a 
> simple case?
> 
>  file(GENERATE
>       OUTPUT "the_output.txt"
>       CONTENT "The content"
>       CONDITION 1
>    )
> 
> That will be generated N times in multi-config generators, and once for 
> single-config, right? Currently in my branch it is an error to cause one 
> file name to be used to generate content twice.

Make it an error if different *content* will be written to the same
file name by different configurations.  Generate for all configs into
per-config temp files.  Then identify all files that map to a single
name according to the OUTPUT genex and make sure they are the same.

-Brad



More information about the cmake-developers mailing list