Skip to content

Commit

Permalink
soc: nordic: make -include a compiler property
Browse files Browse the repository at this point in the history
CMakeLists.txt uses the C compiler parameter -include,
This is causing issues for other toolchains and needs to generalized.

Signed-off-by: Robin Kastberg <[email protected]>
  • Loading branch information
RobinKastberg committed Dec 13, 2024
1 parent 07df2c5 commit ce322c5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions cmake/compiler/compiler_flags_template.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 2 additions & 0 deletions cmake/compiler/gcc/compiler_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
6 changes: 4 additions & 2 deletions soc/nordic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ce322c5

Please sign in to comment.