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 <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2019-03-14 11:50:08 -05:00 committed by Kumar Gala
parent cb3fe3cc46
commit 3713ea4761

View file

@ -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})