soc: nordic: make -include a compiler property

CMakeLists.txt uses the C compiler parameter -include,
This is causing issues for other toolchains and needs to generalized.

Signed-off-by: Robin Kastberg <robin.kastberg@iar.com>
This commit is contained in:
Robin Kastberg 2024-11-15 14:55:24 +01:00 committed by Benjamin Cabé
commit 742679a928
3 changed files with 9 additions and 2 deletions

View file

@ -143,3 +143,6 @@ set_compiler_property(PROPERTY no_builtin_malloc)
# Compiler flag for defining specs. Used only by gcc, other compilers may keep
# this undefined.
set_compiler_property(PROPERTY specs)
# Compiler flag for defining preinclude files.
set_compiler_property(PROPERTY include_file)

View file

@ -244,3 +244,5 @@ set_compiler_property(PROPERTY no_builtin -fno-builtin)
set_compiler_property(PROPERTY no_builtin_malloc -fno-builtin-malloc)
set_compiler_property(PROPERTY specs -specs=)
set_compiler_property(PROPERTY include_file -include)

View file

@ -17,11 +17,13 @@ zephyr_library_sources(
# headers for different SoCs.
set(dt_binding_includes ${DTS_INCLUDE_FILES})
list(FILTER dt_binding_includes INCLUDE REGEX "/dt-bindings/.*\.h$")
list(TRANSFORM dt_binding_includes PREPEND "-include;")
set(include_flag $<TARGET_PROPERTY:compiler,include_file>$<SEMICOLON>)
set_source_files_properties(
validate_binding_headers.c
DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
PROPERTIES COMPILE_OPTIONS "${dt_binding_includes}"
PROPERTIES COMPILE_OPTIONS "${include_flag}$<JOIN:${dt_binding_includes},;${include_flag}>"
)
if(CONFIG_SOC_HAS_TIMING_FUNCTIONS AND NOT CONFIG_BOARD_HAS_TIMING_FUNCTIONS)