From 3713ea4761079dccf1bff8ee54ea4c3c93614b0b Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Thu, 14 Mar 2019 11:50:08 -0500 Subject: [PATCH] cmake: Fix how we set include dirs for userspace To ensure the proper flags are specified to the toolchain, we need to keep system headers and non-system headers seperate and set the SYSTEM flag to target_include_directories for system headers. Signed-off-by: Kumar Gala --- CMakeLists.txt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b31321c719..3e1423e75a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -879,8 +879,6 @@ if(CONFIG_USERSPACE) get_property(compile_definitions_interface TARGET zephyr_interface PROPERTY INTERFACE_COMPILE_DEFINITIONS) - - set(complete_include_dirs ${include_dir_in_interface} ${sys_include_dir_in_interface}) endif() @@ -966,10 +964,14 @@ if(CONFIG_ARM AND CONFIG_USERSPACE) # NB: Using a library instead of target_compile_options(priv_stacks_output_lib # [...]) because a library's options have precedence add_library(priv_stacks_output_lib_interface INTERFACE) - foreach(incl ${complete_include_dirs}) + foreach(incl ${include_dir_in_interface}) target_include_directories(priv_stacks_output_lib_interface INTERFACE ${incl}) endforeach() + foreach(incl ${sys_include_dir_in_interface}) + target_include_directories(priv_stacks_output_lib_interface SYSTEM INTERFACE ${incl}) + endforeach() + target_link_libraries(priv_stacks_output_lib priv_stacks_output_lib_interface) set(PRIV_STACKS_OUTPUT_OBJ_PATH ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/priv_stacks_output_lib.dir/${PRIV_STACKS_OUTPUT_OBJ}) @@ -1087,10 +1089,13 @@ if(CONFIG_USERSPACE) target_link_libraries(output_lib output_lib_interface) - foreach(incl ${complete_include_dirs}) + foreach(incl ${include_dir_in_interface}) target_include_directories(output_lib_interface INTERFACE ${incl}) endforeach() + foreach(incl ${sys_include_dir_in_interface}) + target_include_directories(output_lib_interface SYSTEM INTERFACE ${incl}) + endforeach() set(OUTPUT_OBJ_PATH ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/output_lib.dir/${OUTPUT_OBJ})