What you want can be achieved with #ifdef
. Since debug mode commonly sets -DDEBUG=1
(or -DDBG=1
, you can easily control it either way), you can check for it to determine the mode you are in:
#ifdef DEBUG
static constexpr const char* mode = "debug";
#else
static constexpr const char* mode = "release";
#endif
printf("You are in %s mode\n", mode);
Other config options can be passed as preprocessor flags in the same way.