diff --git a/CMakeLists.txt b/CMakeLists.txt index 20ff0c9caaf..b4d12bb8c87 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -694,6 +694,13 @@ if(CONFIG_ZTEST) endif() +get_property( + syscalls_include_list + TARGET syscalls_interface + PROPERTY INTERFACE_INCLUDE_DIRECTORIES +) +list(APPEND SYSCALL_INCLUDE_DIRS ${syscalls_include_list}) + foreach(d ${SYSCALL_INCLUDE_DIRS}) list(APPEND parse_syscalls_include_args --include ${d} diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index cb878e3b813..8f9be83b140 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -1619,6 +1619,30 @@ function(zephyr_build_string outvar) set(${outvar} ${${outvar}} PARENT_SCOPE) endfunction() +# Function to add one or more directories to the include list passed to the syscall generator. +function(zephyr_syscall_include_directories) + foreach(one_dir ${ARGV}) + if(EXISTS ${one_dir}) + set(include_dir ${one_dir}) + elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${one_dir}) + set(include_dir ${CMAKE_CURRENT_SOURCE_DIR}/${one_dir}) + else() + message(FATAL_ERROR "Syscall include directory not found: ${one_dir}") + endif() + + target_include_directories( + syscalls_interface INTERFACE + ${include_dir} + ) + add_dependencies( + syscalls_interface + ${include_dir} + ) + + unset(include_dir) + endforeach() +endfunction() + # Function to add header file(s) to the list to be passed to syscall generator. function(zephyr_syscall_header) foreach(one_file ${ARGV})