[CMake] Revision header

Johannes Zarl johannes.zarl at jku.at
Mon Jan 23 09:00:48 EST 2012


On Saturday, 21. January 2012, 22:51:01, Oliver Smith wrote:
> I have a script that generates a revision.h file, I've spent the morning
> trying to figure out how to make it so that ... any time CMake rebuilds
> any of the other targets, it starts by running the make-new-revision
> script.
> 
> The idea is, I use the script manually to upversion, but anytime I type
> "make" and /anything/ has to be done (even just a relink), it will do
> the upversion first.
> 
> I've only managed to make it either source dependent or always build,
> which forces the versionNo file to recompile and forces all executables
> to relink, so if you type:
> 
> make ; make ... it will have to relink the executables the second time
> because of an pointless upversion :)

I guess the most efficient way is to fix your upversion script so that it only 
overwrites revision.h if it actually changed. This way you can execute it 
every time without having it mess up the dependency tracking...


  Johannes


More information about the CMake mailing list