zephyrproject-rtos/west

add_compile_definitions does not "propagate upwards" when invoked from west

erlingrj opened this issue · 1 comments

I have this simple project

CMakeLists.txt

add_subdirector(foo)
target_sources(app PRIVATE main.c)

foo/CMakeLists.txt

add_compile_definitions(FOO=42)

The expected behavior is that main.c is compiled with -DFOO=42. However, this is not the case. For some reason the compile definitions does not propagate "upwards" as they are supposed to do. If I instead do

CMakeLists.txt

add_compile_definitions(FOO=42)
target_sources(app PRIVATE main.c)

Then everything works as expected. Any suggestions here?

I moved this to zephyr instead: zephyrproject-rtos/zephyr#53579