Let's say I have a sketch that uses a bunch of libraries: A, B ,C.... All these libraries also refer to some common bottom-level utility library U. That library U provides an assert-like macro: `my_assert(condition)`. To control what this macro does the user has to define (or not to define) `NDEBUG` macro. (I.e. it works the same way the standard `assert` works.) All libraries A, B ,C... use that macro. My sketch also uses that macro.
So, let's say I finally decided to compile the "release" version of my sketch. Which means that I will have to do `#define NDEBUG` and re-compile everything (including all libraries) in presence of that `NDEBUG` definition. What is the proper way to do it within Arduino IDE's approach to build process?
AFAIK, there's no way to just globally ask Arduino IDE to supply `-DNDEBUG` to avr-gcc commands. (Unless I directly edit the config file, which is not the way to go).
Another common approach is to create something like `options.h` file and include it "everywhere". Global macro definitions like `#define NDEBUG` will go into that file. But where do I place that file? Common sense says that these settings are sketch-specific, meaning that each sketch should be able to define its own `options.h`. But, unless I'm missing something, implementation files in the libraries will not see my sketch-specific `options.h`...
So, what is the common practice for performing this kind of macro-based global configuration of Arduino IDE projects?