How do I only add a compile definition only on debug builds?

So I want to add a -DMIN_LOG_DEBUG when building on debug build type. I tried the following

target_compile_definitions(main_lib INTERFACE $<$<CONFIG:Debug>:MIN_LOG_DEBUG>)

which works fine in debug builds but on any other build types I get the following error:

: error: macro names must be identifiers

This is because there is an empty -D in the resulting compile flags. How can I solve this?

2 Likes

This was an unrelated user error. Feel free to delete this post.

1 Like