On 2007-10-04 18:20+0100 Atwood, Robert C wrote:



From: Alan W. Irwin
[...]I've tried the following in CMakeLists, placing the output of
'svnversion' and similar commands into an included source
file and it
works [...]

Can some form of dependency be set so that if any source file is
changed [...]

Or, should I use another way to do what I want?

One possibility is to use subversion (which presumably you
are using since
you referred to svnversion) keyword functionality.

For example, if you put $Id$ into your source code comments,

That does not work, since the comments do not go into the executable.

That's just a (poorly chosen) example.  You can put $Id$ or $Revision"
anywhere in the code that insures it gets into the executable.

Yes, [svnversion] is the whole point! It is much easier than using individual
revision nubmers for each file.

Although not nearly as informative.  I just tried svnversion, and it only
gives a range of Revision numbers for the source tree. That's a non-unique
way of identifying source trees since you could have extremely different
source trees with the exact same revision range.

However, simplicity that usually might work often trumps correct complexity
so I anticipated in my previos post that you might want to stick with
svnversion and actually mentioned one possibility for that case (add a
custom command using the TARGET signature).  I guess you missed that
suggestion.  If that suggestion doesn't work, then another alternative is to
generate a special header file filled with svnversion results at cmake time
which your souce code #includes in a way to make sure the svnversion results
gets into your executable(s). I believe cmake is smart enough to ignore
changed time stamps on that generated source file if the contents are
identical, but if not you can try cmake -E copy_if_different to get the time
stamp right.

Note, I believe there are many different ways of implementing what you want.
I am just giving you some ideas here (and somebody else has as well), and
you will have to experiment and dig into the documentation to get one of
these ideas to work.

So good luck.

Alan

__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to