Reputation: 583
Is there a way do define a global macro, like _DEBUG in VS 2013 to be global per project? I want to use macro for conditional buld for different versions of application and avoid to include *.h.file containing the definition.
#define APP_VERSION_MAJOR 1
#define APP_VERSION_MINOR 0
#define APP_VERSION_HOTFIX 0
#define APP_VERSION_DEV a
#define APP_VER_STR_(s) #s
#define APP_VER_STR(s) APP_VER_STR_(s)
#define APP_VERSION APP_VER_STR(APP_VERSION_MAJOR) "." APP_VER_STR(APP_VERSION_MINOR) "." APP_VER_STR(APP_VERSION_HOTFIX) "." APP_VER_STR(APP_VERSION_DEV)
Upvotes: 0
Views: 1569
Reputation: 4184
I would use the build system to pass the definitions to the C / C++ compiler using the -D syntax:
-DVERSION=2.0.3
Upvotes: 1