Page 1 of 1

Where to Define Preprocessor Symbols in Different Build or Launch Configurations?

Posted: Wed May 29, 2024 1:58 pm
by CseaTec
Hello all. I tried searching the various forums for answers to my questions, but the search engine keeps crashing if I enter more than one word in my advance search string. So, if this is a duplicate question, please forgive me. I tried!

I have a ESP-IDF CMAKE project for which I want to create different Build Configurations. I found that any access to "Build Configurations" is all grayed out. I did not understand this, so I decided to look into using "Launch Configurations" instead. Here (under the gear icon), it appears I can create more than one launch configuration.

So, within a given Launch Configuration, where can I define a particular Preprocessor Symbol so one Launch Configuration builds for say "PRODUCT_A" whereas another launch configuration will build for "PRODUCT_B"? I have been able to do this in the past with all IDEs using build configurations, but this Espressif IDE with the IDF seems more difficult perhaps because it is CMAKE based. What am I doing wrong? Is there a secret to using "build configurations" (caused them to not be grayed out), or do I need to do this within "launch configurations"?

Thank you for any help.

Re: Where to Define Preprocessor Symbols in Different Build or Launch Configurations?

Posted: Wed May 29, 2024 3:17 pm
by liaifat85
To manage different build configurations in an ESP-IDF CMake project, it's usually done via command-line options or scripting within CMakeLists.txt rather than through IDE-specific "build configurations.

Re: Where to Define Preprocessor Symbols in Different Build or Launch Configurations?

Posted: Wed May 29, 2024 3:36 pm
by CseaTec
liaifat85 wrote:
Wed May 29, 2024 3:17 pm
To manage different build configurations in an ESP-IDF CMake project, it's usually done via command-line options or scripting within CMakeLists.txt rather than through IDE-specific "build configurations.

Thank you for that input. I was suspecting that and given I'm a bit of a CMAKE ignoramus. Can you point me to a meaningful example of creating such command-line options to define a preprocessor symbol in my CMakeLists.txt file?

Re: Where to Define Preprocessor Symbols in Different Build or Launch Configurations?

Posted: Thu May 30, 2024 11:48 am
by liaifat85
Could not find any solid example or tutorial. But here is a thread is slightly related to what you're looking for.
https://stackoverflow.com/questions/856 ... with-cmake