cmake: Add target for generating header files

Before C sources can be compiled any generated header that they
include must be generated. Currently, the target 'offsets_h' happens
to depend directly or indirectly on all generated headers.

This means that to compile safely, one can simply depend on
'offsets_h'. But this is coincidental and might not be true in the
future.

To be able to safely depend on a target that represents all generated
headers being ready we introduce the target
'zephyr_generated_headers'.

Any third-party build scripts can now safely depend on
'zephyr_generated_headers' and be protected from any internal changes
to the build system, like the removal of offsets_h.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
This commit is contained in:
Sebastian Bøe 2020-01-23 15:39:17 +01:00 committed by Kumar Gala
commit fdac7b3319
5 changed files with 25 additions and 9 deletions

View file

@ -58,6 +58,6 @@ target_include_directories(kernel PRIVATE
${ZEPHYR_BASE}/arch/${ARCH}/include
)
add_dependencies(kernel ${OFFSETS_H_TARGET})
add_dependencies(kernel zephyr_generated_headers)
target_link_libraries(kernel zephyr_interface)