[cmake-developers] Generating files at generate-time
Stephen Kelly
steveire at gmail.com
Thu May 2 13:44:11 EDT 2013
Brad King wrote:
> 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.
>
I don't think that requires writing for all configs to temp files. I can
write the first file if it doesn't exist, and for subsequent configs,
compare the evaluated content with the existing content in the file.
Am I missing something?
Thanks,
Steve.
More information about the cmake-developers
mailing list