executable version (compile vs link time)

Started by
5 comments, last by SiCrane 12 years, 4 months ago
is there a way to generic portable solution to versioning of an exec file?
ie: like creating a string buffer filled with __DATE__ and __TIME__ macros, and stuffing them "somewhere", so that whenever the exe is relinked (not compiled!) it gets updated?
Advertisement
I don't know of anything that isn't compiler or build-process dependent.

What's the problem you need to solve?

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

well, if I do something like:

class TVersion {
public:
static char formatbuffer[1024];
int major;
int minor;
const char *date;
const char *time;
public:
TVersion(int vmajor, int vminor)
{
major = vmajor;
minor = vminor;
date = __DATE__;
time = __TIME__;
//
sprintf( formatbuffer, "%d.%d.%s.%s", major, minor, date, time );
}
};

main.cpp:

TVersion gVersion( 1, 1 );
pVersion = &gVersion;


pVersion is "latest" only when full rebuild is on, or when it is being force recompiled. What I would like is to trigger recompile of this obj, for any modified file in the solution, which has effect on target exec. This is basically the file creation time, but from "code" :)

makes sense?
I have seen an addon for visual studio once, which would do the job. It was used to edit a resource-file that holds the file-data automatically on every build.
"date /T >> foo.exe"

"date /T >> foo.exe"


good one :)
I'd just add a pre-build step to touch the cpp file.

This topic is closed to new replies.

Advertisement