[cmake-developers] Generating files at generate-time

Brad King brad.king at kitware.com
Thu May 2 13:54:48 EDT 2013


On 05/02/2013 01:44 PM, Stephen Kelly wrote:
> Brad King wrote:
>> 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.

Yes, that should work too.  Note that for the first config that evaluates
to a specific output you should write that file unconditionally (or as
copy-if-different).  It should ignore existing content for comparison
purposes because the file could exist from a previous run of CMake.

-Brad



More information about the cmake-developers mailing list