[CMake] automagically generated header hell

dsomers at trevezel.com dsomers at trevezel.com
Mon Jul 3 06:56:41 EDT 2006


On Mon, July 3, 2006 11:13 am, Benjamin THYREAU wrote:
>> I had a situation where a tool would always regenerate a h file... I
>> fudge the issue now by caching the file and only replace it if diff says
>> the file really is different (opposed to just being newer).
>>
> Hi, I have kindof similar situation, so i'm curious about how you did
> that. Did you make your own custom external script (calling diff), or is
> there a standard way to do it ?

Custom external script: I used a CUSTOM_COMMAND to execute a bash script
to do it. I can send you the script if you are interested.

I should have really written the external script in CMake and run it with
Cmake -P ... but I couldn't figure out how to pass parameters when
invoking the script.

> Also, my generated headers sometimes
> differs only by a C comment (a timestamp in fact), so do  someone know if
> there is a customizable way to compare files for uptodateness ?

A dirty way would be to use something like awk to strip out the comment
before comparing the files with diff.

There is a tool called Metre [1] which does metric analysis of C files...
in the readme the author said he used its engine as a basis to do a diff
and the language level... its something I've wanted to look at but have
been busy with other things... lexical diff of C opposed to source diff
would be very useful to have.

[1] http://www.chris-lott.org/resources/cmetrics/metre-2.3.tar.gz

Regards,

David Somers
typographer/programmer/whatever




More information about the CMake mailing list