SanderMertens/bake

Preprocessor Definitions

yuvaldolev opened this issue · 2 comments

I really like this build system, it’s really awesome!
I only have one question: How do you add preprocessor definitions using bake?

Awesome, glad you like it!

You can do this by using the cflags attribute of the lang.c (or lang.cpp, depending on whether you use C or C++) configuration:

{
    "id": "my_app",
    "type": "application",
    "lang.c": {
        "cflags": ["-DMY_DEFINITION"]
    }
}

The documentation for this attribute is here: https://github.com/SanderMertens/bake/tree/master/drivers/lang/c

While writing this, I'm thinking it would be nice to have a dedicated attribute for this, since it's such a common thing to do, and different compilers may use different compiler flags.

Awesome, thanks!