I would like to compile in two environment variables (BUILD_NUMBER and NODE_NAME) that our Jenkins system defines so that these compile time values are saved, and then those saved values are accessed as our program is being run (regardless of what the user has presently set BUILD_NUMBER and NODE_NAME to.)
Is this possible using Visual Studio 2008? It would be nice if I could accomplish this entirely within our code, and did not have to modify the compilation system to pass anything along.
One way that you could make this work is by adding a pre-build step that executes a batch file with something like
Then from your source you
#include "jenkins.h"and have immediate access to the macroBUILD_NUMBERwhich is baked in at compile time.