Get configuration name

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
HuEl_264296
Level 5
Level 5
First like given 25 sign-ins First solution authored

It's it possible for the code to find out the name of the build configuration that's being used. I know I can #ifdef NDEBUG to detect of this build is the debug one or not, but what if there was a third configuration. It's there some way the code could get the name of the configuration as a string. I.e "debug" or "release", etc.? Many thanks

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

just use

   

#ifdef DEBUG

   

const char Configuration[] = "Debug";

   

#endif

   

 

   

Bob

View solution in original post

0 Likes
5 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

When there will be a third configuration there will be a third name. But all that will not help you much: each of the parameters collected under a configuration can be changed without getting a note via a #defined value.

   

You may #define your own names for each configuration, there is room for that in the build settings.

   

 

   

Bob

0 Likes
HuEl_264296
Level 5
Level 5
First like given 25 sign-ins First solution authored
        The software doesn't need the know the particular settings. It just needs the name as a string so that I can ask the board at a later date which build it programmed with.   
0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

just use

   

#ifdef DEBUG

   

const char Configuration[] = "Debug";

   

#endif

   

 

   

Bob

0 Likes
HuEl_264296
Level 5
Level 5
First like given 25 sign-ins First solution authored
        I already have that. And what if there's a third configuration?   
0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Then the else-part will be executed. But as you know, there is no third configuration.

   

 

   

Bob