Skip to content

Configuration file: any way to get a boolean value? #252

Answered by rewrking
paulross80 asked this question in Q&A
Discussion options

You must be logged in to vote

Hmmm... You can obviously do this any number of ways, but I'm used to using a preprocessor definition at build time:

"settings:Cxx": {
   "defines[:debug]": [
      "_DEBUG"
   ]
}
namespace app1::constants
{
#if defined(_DEBUG)
constexpr bool debug = true;
#else
constexpr bool debug = false;
#endif
}

So you can do that in the meantime, but yes - I think there should be some mechanism for boolean values like you describe. I'll have to revisit config files because right now the same one is shared across build configurations, so it's a bug to put the ${configuration} string into it at the moment. It was mainly designed with versioning in mind.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@paulross80
Comment options

@rewrking
Comment options

@paulross80
Comment options

Answer selected by paulross80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants