From 267a790115c48185d793fd2e4d09e868ae89c568 Mon Sep 17 00:00:00 2001 From: Robin Kastberg Date: Fri, 15 Nov 2024 14:55:24 +0100 Subject: [PATCH] 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 --- cmake/compiler/compiler_flags_template.cmake | 3 +++ cmake/compiler/gcc/compiler_flags.cmake | 2 ++ soc/nordic/CMakeLists.txt | 6 ++++-- 3 files changed, 9 insertions(+), 2 deletions(-) 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)