...get the current Subversion version number?
- Add a JavaScript file to your project called getversion.js containing the following code:
function getVersion()
{
var version;
if (CWSys.run("svnversion", true) == 0)
version = CWSys.getRunStdout();
CWSys.writeStringToFile("version.h", "#define VERSION \"" + version + "\"");
} - Add a file called getversion.h to your project containing the following code:
#ifndef GETVERSION_H
#define GETVERSION_H
const char *getVersion();
#endif - Add a file called getversion.c to your project containing the following code:
#include "getversion.h"
#include "version.h"
const char *getVersion()
{
return VERSION;
} - Set the Build Options > Always Rebuild project property of getversion.c to Yes.
- Set the User Build Step Options > Pre-Compile Command project property of getversion.c to "$(StudioDir)/bin/crossscript" "load(\"$(ProjectDir)/getversion.js\");getVersion();"
Please sign in to leave a comment.
Comments
0 comments