mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-03 12:44:33 +02:00
feat(cmake): introduce MINIMAL_BUILD build property
Introduce a MINIMAL_BUILD property to streamline the build process by including only the main component and its direct and indirect dependencies. This serves as a convenient shortcut for using set(COMPONENTS main). The MINIMAL_BUILD build property is ignored if the COMPONENTS variable is defined, as COMPONENTS takes precedence. To enable a minimal build, add "idf_build_set_property(MINIMAL_BUILD ON)" to the project's CMake configuration. Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
This commit is contained in:
@@ -495,6 +495,24 @@ function(__project_init components_var test_components_var)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# If a minimal build is requested, set COMPONENTS to "main" only if the COMPONENTS
|
||||
# variable is not already defined. The COMPONENTS variable takes precedence over
|
||||
# the MINIMAL_BUILD property.
|
||||
idf_build_get_property(minimal_build MINIMAL_BUILD)
|
||||
if(minimal_build)
|
||||
if(DEFINED COMPONENTS)
|
||||
message(WARNING "The MINIMAL_BUILD property is disregarded because the COMPONENTS variable is defined.")
|
||||
set(minimal_build OFF)
|
||||
else()
|
||||
set(COMPONENTS main)
|
||||
set(minimal_build ON)
|
||||
endif()
|
||||
else()
|
||||
set(minimal_build OFF)
|
||||
endif()
|
||||
|
||||
message(STATUS "Minimal build - ${minimal_build}")
|
||||
|
||||
spaces2list(COMPONENTS)
|
||||
spaces2list(EXCLUDE_COMPONENTS)
|
||||
idf_build_get_property(component_targets __COMPONENT_TARGETS)
|
||||
|
Reference in New Issue
Block a user