mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
fix(bootloader/cmakev2): exclude all paths matching BOOTLOADER_IGNORE_EXTRA_COMPONENT
Walk every directory contributed via BOOTLOADER_EXTRA_COMPONENT_DIRS (both shared and direct component paths, not only those under the application's bootloader_components/) and exclude any whose component name matches BOOTLOADER_IGNORE_EXTRA_COMPONENT.
This commit is contained in:
@@ -27,10 +27,29 @@ if(EXISTS ${PROJECT_EXTRA_COMPONENTS})
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(IGNORE_EXTRA_COMPONENT)
|
if(IGNORE_EXTRA_COMPONENT)
|
||||||
# Prefix all entries of the list with ${PROJECT_EXTRA_COMPONENTS} absolute path
|
foreach(extra_component_dir ${EXTRA_COMPONENT_DIRS})
|
||||||
list(TRANSFORM IGNORE_EXTRA_COMPONENT
|
# Strip trailing slash so get_filename_component(NAME) returns the
|
||||||
PREPEND "${PROJECT_EXTRA_COMPONENTS}/"
|
# component name rather than an empty string.
|
||||||
OUTPUT_VARIABLE EXTRA_COMPONENT_EXCLUDE_DIRS)
|
string(REGEX REPLACE "/+$" "" extra_component_dir "${extra_component_dir}")
|
||||||
|
if(EXISTS "${extra_component_dir}/CMakeLists.txt")
|
||||||
|
# BOOTLOADER_EXTRA_COMPONENT_DIRS may point directly to a single component.
|
||||||
|
get_filename_component(component "${extra_component_dir}" NAME)
|
||||||
|
if(component AND ${component} IN_LIST IGNORE_EXTRA_COMPONENT)
|
||||||
|
list(APPEND EXTRA_COMPONENT_EXCLUDE_DIRS "${extra_component_dir}")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
# BOOTLOADER_EXTRA_COMPONENT_DIRS may also point to a directory containing
|
||||||
|
# multiple component directories.
|
||||||
|
file(GLOB proj_components RELATIVE ${extra_component_dir} ${extra_component_dir}/*)
|
||||||
|
foreach(component ${proj_components})
|
||||||
|
# Only directories are considered components.
|
||||||
|
if(IS_DIRECTORY "${extra_component_dir}/${component}"
|
||||||
|
AND ${component} IN_LIST IGNORE_EXTRA_COMPONENT)
|
||||||
|
list(APPEND EXTRA_COMPONENT_EXCLUDE_DIRS "${extra_component_dir}/${component}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user