diff --git a/cmake/compiler/compiler_flags_template.cmake b/cmake/compiler/compiler_flags_template.cmake index 5a4386f49beb77..8c540c15d06486 100644 --- a/cmake/compiler/compiler_flags_template.cmake +++ b/cmake/compiler/compiler_flags_template.cmake @@ -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) diff --git a/cmake/compiler/gcc/compiler_flags.cmake b/cmake/compiler/gcc/compiler_flags.cmake index 5d348a2aacc2d5..0ef1c2670a2edf 100644 --- a/cmake/compiler/gcc/compiler_flags.cmake +++ b/cmake/compiler/gcc/compiler_flags.cmake @@ -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) diff --git a/soc/nordic/CMakeLists.txt b/soc/nordic/CMakeLists.txt index cebbdf155007c7..5aec1af882002a 100644 --- a/soc/nordic/CMakeLists.txt +++ b/soc/nordic/CMakeLists.txt @@ -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 $$) + set_source_files_properties( validate_binding_headers.c DIRECTORY ${CMAKE_CURRENT_LIST_DIR} - PROPERTIES COMPILE_OPTIONS "${dt_binding_includes}" + PROPERTIES COMPILE_OPTIONS "${include_flag}$" ) if(CONFIG_SOC_HAS_TIMING_FUNCTIONS AND NOT CONFIG_BOARD_HAS_TIMING_FUNCTIONS)