diff --git a/cmake/nuttx_add_library.cmake b/cmake/nuttx_add_library.cmake index 9290083d1a..71b57c97aa 100644 --- a/cmake/nuttx_add_library.cmake +++ b/cmake/nuttx_add_library.cmake @@ -37,9 +37,8 @@ function(nuttx_add_library_internal target) # add main include directories target_include_directories( - ${target} SYSTEM - PRIVATE ${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include - ${CMAKE_BINARY_DIR}/include_arch) + ${target} SYSTEM PRIVATE ${CMAKE_SOURCE_DIR}/include + ${CMAKE_BINARY_DIR}/include) # Set global compile options & definitions We use the "nuttx" target to hold # these properties so that libraries added after this property is set can read diff --git a/cmake/nuttx_allsyms.cmake b/cmake/nuttx_allsyms.cmake index beeec799e9..c4ce271c42 100644 --- a/cmake/nuttx_allsyms.cmake +++ b/cmake/nuttx_allsyms.cmake @@ -54,8 +54,7 @@ macro(define_allsyms_link_target inter_target dep_target allsyms_file) ) endif() target_sources(nuttx PRIVATE ${ALLSYMS_SOURCE}) - set(ALLSYMS_INCDIR ${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include - ${CMAKE_BINARY_DIR}/include_arch) + set(ALLSYMS_INCDIR ${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include) set_source_files_properties( ${ALLSYMS_SOURCE} PROPERTIES INCLUDE_DIRECTORIES "${ALLSYMS_INCDIR}") else() @@ -76,9 +75,8 @@ macro(define_allsyms_link_target inter_target dep_target allsyms_file) # relink target and nuttx have exactly the same configuration target_include_directories( - ${inter_target} SYSTEM - PUBLIC ${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include - ${CMAKE_BINARY_DIR}/include_arch) + ${inter_target} SYSTEM PUBLIC ${CMAKE_SOURCE_DIR}/include + ${CMAKE_BINARY_DIR}/include) target_compile_definitions( ${inter_target} PRIVATE $) target_compile_options( diff --git a/cmake/nuttx_generate_headers.cmake b/cmake/nuttx_generate_headers.cmake index 8c7523f8c7..8cb290f9d1 100644 --- a/cmake/nuttx_generate_headers.cmake +++ b/cmake/nuttx_generate_headers.cmake @@ -35,42 +35,40 @@ include(nuttx_mkversion) # Setup symbolic link generation -if(NOT EXISTS ${CMAKE_BINARY_DIR}/include_arch/arch) - execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory - ${CMAKE_BINARY_DIR}/include_arch/arch) -endif() - if(NOT EXISTS ${CMAKE_BINARY_DIR}/include_apps) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/include_apps) endif() if(NOT EXISTS ${CMAKE_BINARY_DIR}/include/arch) - nuttx_create_symlink(${NUTTX_DIR}/arch/${CONFIG_ARCH}/include - ${CMAKE_BINARY_DIR}/include/arch) + execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory + ${CMAKE_BINARY_DIR}/include/arch) + file(GLOB CONTENTS ${NUTTX_DIR}/arch/${CONFIG_ARCH}/include/*) + foreach(ARCH_INCDIR ${CONTENTS}) + get_filename_component(SUB_ELEMENT ${ARCH_INCDIR} NAME) + nuttx_create_symlink(${NUTTX_DIR}/arch/${CONFIG_ARCH}/include/${SUB_ELEMENT} + ${CMAKE_BINARY_DIR}/include/arch/${SUB_ELEMENT}) + endforeach() endif() -if(NOT EXISTS ${CMAKE_BINARY_DIR}/include_arch/arch/board) +if(NOT EXISTS ${CMAKE_BINARY_DIR}/include/arch/board) if(EXISTS ${NUTTX_BOARD_DIR}/include) nuttx_create_symlink(${NUTTX_BOARD_DIR}/include - ${CMAKE_BINARY_DIR}/include_arch/arch/board) + ${CMAKE_BINARY_DIR}/include/arch/board) elseif(EXISTS ${NUTTX_BOARD_DIR}/../common/include) nuttx_create_symlink(${NUTTX_BOARD_DIR}/../common/include - ${CMAKE_BINARY_DIR}/include_arch/arch/board) + ${CMAKE_BINARY_DIR}/include/arch/board) endif() endif() -if(NOT EXISTS ${CMAKE_BINARY_DIR}/include_arch/arch/chip) +if(NOT EXISTS ${CMAKE_BINARY_DIR}/include/arch/chip) if(CONFIG_ARCH_CHIP_CUSTOM) - execute_process( - COMMAND ${CMAKE_COMMAND} -E copy_directory ${NUTTX_CHIP_ABS_DIR}/include - ${CMAKE_BINARY_DIR}/include_arch/arch/chip) + nuttx_create_symlink(${NUTTX_CHIP_ABS_DIR}/include + ${CMAKE_BINARY_DIR}/include/arch/chip) else() - execute_process( - COMMAND - ${CMAKE_COMMAND} -E copy_directory - ${NUTTX_DIR}/arch/${CONFIG_ARCH}/include/${CONFIG_ARCH_CHIP} - ${CMAKE_BINARY_DIR}/include_arch/arch/chip) + nuttx_create_symlink( + ${NUTTX_DIR}/arch/${CONFIG_ARCH}/include/${CONFIG_ARCH_CHIP} + ${CMAKE_BINARY_DIR}/include/arch/chip) endif() endif()