Specify program #define thru IDE

i have a #ifdef for specific hardware options in my code
is there a way to specify a unique #define value via the IDE (preferences?)
thsi how i would do it in a Makefile
CPPFLAGS += DMyDef

You can add an option to boards.txt or edit the build recipes in platform.txt.

by board i mean my board that uses an esp32.
it's an option external to the esp32

AFAIK, all build rules are defined by boards.txt and platform.txt. You cannot change compiler flags on a per-project basis.

You can add a menu option yourself, then you get an option that you can enable or disable from the Tools menu, but it will still be board-specific.

For example, here's what I use to conditionally add -DDEBUG_OUT=Serial:

https://tttapa.github.io/Arduino-Helpers/Doxygen/de/daf/md_pages_Debug.html

You might want to look into using a more professional framework like ESP-IDF or PlatformIO, where you can actually use a decent build system like CMake.

ok, thanks for explanation and effort

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.