[CMake] Making a variable a dependency...

Alexander Neundorf a.neundorf-work at gmx.net
Mon Feb 6 16:56:18 EST 2012


On Saturday 04 February 2012, Oliver Smith wrote:
> My CMakeLists uses the Subversion repository information in a couple of
> places (it configures a file revision.h and it uses it for the CPack
> package name).
> 
> The problem is that this variable is cached and retained until the cache
> is rebuilt, instead of being calculated or evaluated per make. So if I
> do a build, then do an svn update and pull some changes, it will build a
> new executable but it will stamp it with the revision number from when
> CMake last regenerated the make files...
> 
> Is there a way to mark a variable as volatile or something so that CMake
> will always recalculate it and check if it has changed?

Would it be acceptable if cmake would rerun after every build ?
You could enforce that e.g. with a add_custom_command( POST_BUILD ... ) which 
could e.g. touch CMakeCache.txt or something.

Better ideas ?

Alex


More information about the CMake mailing list