feat(cmakev2/component): add embedded files in idf_component_include

Add embedded source files to the component target sources. This is
intentionally managed in idf_component_include instead of
idf_component_register, allowing even cmakev2 components to set the
component's EMBED_FILES and EMBED_TXTFILES properties. Although it might
be more convenient to call the target_add_binary_data helper function
directly in cmakev2.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
This commit is contained in:
Frantisek Hrbata
2025-10-30 17:17:49 +08:00
committed by BOT
parent e84250998d
commit 9040925c1c
+16
View File
@@ -619,6 +619,22 @@ function(idf_component_include name)
idf_die("Unsupported target type '${component_real_target_type}' in component '${component_name}'")
endif()
idf_component_get_property(embed_files "${component_name}" EMBED_FILES)
foreach(file IN LISTS embed_files)
target_add_binary_data(${COMPONENT_TARGET} "${file}" "BINARY")
endforeach()
idf_component_get_property(embed_txtfiles "${component_name}" EMBED_TXTFILES)
foreach(file IN LISTS embed_txtfiles)
target_add_binary_data(${COMPONENT_TARGET} "${file}" "TEXT")
endforeach()
idf_component_get_property(ldfragments "${component_name}" LDFRAGMENTS)
if(ldfragments)
# FIXME: Enable this once the ldgen integration is implemented.
# ldgen_add_fragment_files("${ldfragments}")
endif()
# Components for cmakev1 use the idf_component_register call and are
# managed in cmakev2 through a shim. This shim sets the COMPONENT_FORMAT
# property to CMAKEV1 and applies global compilation options and