We are looking for a way to include some kind of assembly identifier automatically in our assemblies. This should be portable (VC ++, g ++ on Linux and Mac) and automatic. VC ++ is the most important thing, because in other environments we use our own Python build scripts so that I can do whatever I want.
We use SVN, so we are considering using svnversion output to write the revision to the header and include it. This has problems: if we put the file in SVN, it will appear as changed every time, but it will be an unnecessary commit and, in a sense, generates an endless cycle of increasing revisions. If we don’t put the file in SVN and just create it as a pre-build step, the sources will not be complete, because creating this file will require a preliminary collection or Makefile.
We can also use __DATE__ , but we cannot guarantee that a file that uses __DATE__ (i.e. writes it to a log file) will be compiled if any other file is modified - unless we “touch” it, but then we will make the project always out of date. We could touch it as a pre-build step, so it will be affected only if the rest of the project is out of date, therefore it does not cause false compilation, but if VC ++ calculates the dependencies before the pre-build step, it won’t work (file with __DATE__ will not be compiled)
Any interesting ideas?
c ++ svn visual-c ++ visual-studio
ggambett
source share