Skip to content

Commit

Permalink
Change INTERFACE to SYSTEM INTERFACE target_include_directories
Browse files Browse the repository at this point in the history
Should not be merged upstream, just a proof of concept
  • Loading branch information
ooxi committed Jul 20, 2022
1 parent d1e7294 commit afb46fe
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ macro(pico_simple_hardware_headers_target NAME)
if (NOT TARGET hardware_${NAME}_headers)
add_library(hardware_${NAME}_headers INTERFACE)

target_include_directories(hardware_${NAME}_headers INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
target_include_directories(hardware_${NAME}_headers SYSTEM INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
target_link_libraries(hardware_${NAME}_headers INTERFACE pico_base_headers)
if (NOT PICO_NO_HARDWARE)
target_link_libraries(hardware_${NAME}_headers INTERFACE hardware_structs hardware_claim)
Expand All @@ -82,7 +82,7 @@ macro(pico_simple_hardware_headers_only_target NAME)
# pico_add_sdk_impl_library(hardware_${NAME})
add_library(hardware_${NAME} INTERFACE)

target_include_directories(hardware_${NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
target_include_directories(hardware_${NAME} SYSTEM INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
target_link_libraries(hardware_${NAME} INTERFACE pico_base_headers)
if (NOT PICO_NO_HARDWARE)
target_link_libraries(hardware_${NAME} INTERFACE hardware_structs)
Expand Down Expand Up @@ -118,4 +118,4 @@ endfunction()

include(${PICO_PLATFORM_CMAKE_FILE})

pico_promote_common_scope_vars()
pico_promote_common_scope_vars()
4 changes: 2 additions & 2 deletions src/common/pico_base/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
if (NOT TARGET pico_base_headers)
add_library(pico_base_headers INTERFACE)
target_include_directories(pico_base_headers INTERFACE include ${CMAKE_BINARY_DIR}/generated/pico_base)
target_include_directories(pico_base_headers SYSTEM INTERFACE include ${CMAKE_BINARY_DIR}/generated/pico_base)

# PICO_BUILD_DEFINE: PICO_BOARD, Name of board, type=string, default=CMake PICO_BOARD variable, group=pico_base
target_compile_definitions(pico_base_headers INTERFACE
Expand All @@ -10,4 +10,4 @@ if (NOT TARGET pico_base_headers)

list(APPEND PICO_SDK_POST_LIST_FILES ${CMAKE_CURRENT_LIST_DIR}/generate_config_header.cmake)
pico_promote_common_scope_vars()
endif()
endif()
4 changes: 2 additions & 2 deletions src/common/pico_base/generate_config_header.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ file(GENERATE
configure_file( ${CMAKE_CURRENT_LIST_DIR}/include/pico/version.h.in ${CMAKE_BINARY_DIR}/generated/pico_base/pico/version.h)

foreach(DIR IN LISTS PICO_INCLUDE_DIRS)
target_include_directories(pico_base_headers INTERFACE ${DIR})
endforeach()
target_include_directories(pico_base_headers SYSTEM INTERFACE ${DIR})
endforeach()
4 changes: 2 additions & 2 deletions src/common/pico_stdlib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
if (NOT TARGET pico_stdlib_headers)
add_library(pico_stdlib_headers INTERFACE)
target_include_directories(pico_stdlib_headers INTERFACE include)
target_include_directories(pico_stdlib_headers SYSTEM INTERFACE include)
target_link_libraries(pico_stdlib_headers INTERFACE
hardware_gpio
hardware_uart
hardware_divider
pico_time
pico_util
)
endif()
endif()
2 changes: 1 addition & 1 deletion src/host/pico_platform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if (NOT TARGET pico_platform_headers)
PICO_BUILD=1
)

target_include_directories(pico_platform_headers INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
target_include_directories(pico_platform_headers SYSTEM INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
endif()

if (NOT TARGET pico_platform)
Expand Down
2 changes: 1 addition & 1 deletion src/rp2_common/cyw43_driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if (EXISTS ${PICO_CYW43_DRIVER_PATH}/${CYW43_DRIVER_TEST_FILE})
${PICO_CYW43_DRIVER_PATH}/src/cyw43_lwip.c
${PICO_CYW43_DRIVER_PATH}/src/cyw43_ctrl.c
)
target_include_directories(cyw43_driver_base INTERFACE
target_include_directories(cyw43_driver_base SYSTEM INTERFACE
${PICO_CYW43_DRIVER_PATH}/src
${PICO_CYW43_DRIVER_PATH}/firmware
)
Expand Down
4 changes: 2 additions & 2 deletions src/rp2_common/hardware_base/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
add_library(hardware_base INTERFACE)
target_include_directories(hardware_base INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
target_link_libraries(hardware_base INTERFACE pico_base_headers)
target_include_directories(hardware_base SYSTEM INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
target_link_libraries(hardware_base INTERFACE pico_base_headers)
4 changes: 2 additions & 2 deletions src/rp2_common/pico_platform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if (NOT TARGET pico_platform_headers)
PICO_BUILD=1
)

target_include_directories(pico_platform_headers INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
target_include_directories(pico_platform_headers SYSTEM INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)

target_link_libraries(pico_platform_headers INTERFACE hardware_regs)
endif()
Expand All @@ -22,4 +22,4 @@ endif()

function(pico_add_platform_library TARGET)
target_link_libraries(pico_platform INTERFACE ${TARGET})
endfunction()
endfunction()
4 changes: 2 additions & 2 deletions tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ function(pico_generate_pio_header TARGET PIO)
add_dependencies(${TARGET} ${HEADER_GEN_TARGET})
get_target_property(target_type ${TARGET} TYPE)
if ("INTERFACE_LIBRARY" STREQUAL "${target_type}")
target_include_directories(${TARGET} INTERFACE ${HEADER_DIR})
target_include_directories(${TARGET} SYSTEM INTERFACE ${HEADER_DIR})
else()
target_include_directories(${TARGET} PUBLIC ${HEADER_DIR})
target_include_directories(${TARGET} SYSTEM PUBLIC ${HEADER_DIR})
endif()
endfunction()

Expand Down

0 comments on commit afb46fe

Please sign in to comment.