Skip to content

Commit 742679a

Browse files
RobinKastbergkartben
authored andcommitted
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 <[email protected]>
1 parent 3aff5c3 commit 742679a

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

cmake/compiler/compiler_flags_template.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,6 @@ set_compiler_property(PROPERTY no_builtin_malloc)
143143
# Compiler flag for defining specs. Used only by gcc, other compilers may keep
144144
# this undefined.
145145
set_compiler_property(PROPERTY specs)
146+
147+
# Compiler flag for defining preinclude files.
148+
set_compiler_property(PROPERTY include_file)

cmake/compiler/gcc/compiler_flags.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,3 +244,5 @@ set_compiler_property(PROPERTY no_builtin -fno-builtin)
244244
set_compiler_property(PROPERTY no_builtin_malloc -fno-builtin-malloc)
245245

246246
set_compiler_property(PROPERTY specs -specs=)
247+
248+
set_compiler_property(PROPERTY include_file -include)

soc/nordic/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ zephyr_library_sources(
1717
# headers for different SoCs.
1818
set(dt_binding_includes ${DTS_INCLUDE_FILES})
1919
list(FILTER dt_binding_includes INCLUDE REGEX "/dt-bindings/.*\.h$")
20-
list(TRANSFORM dt_binding_includes PREPEND "-include;")
20+
21+
set(include_flag $<TARGET_PROPERTY:compiler,include_file>$<SEMICOLON>)
22+
2123
set_source_files_properties(
2224
validate_binding_headers.c
2325
DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
24-
PROPERTIES COMPILE_OPTIONS "${dt_binding_includes}"
26+
PROPERTIES COMPILE_OPTIONS "${include_flag}$<JOIN:${dt_binding_includes},;${include_flag}>"
2527
)
2628

2729
if(CONFIG_SOC_HAS_TIMING_FUNCTIONS AND NOT CONFIG_BOARD_HAS_TIMING_FUNCTIONS)

0 commit comments

Comments
 (0)