From 9040925c1cf76b34bdb6782c7b13f2d302e6bab9 Mon Sep 17 00:00:00 2001 From: Frantisek Hrbata Date: Wed, 20 Aug 2025 12:25:02 +0200 Subject: [PATCH] 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 --- tools/cmakev2/component.cmake | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tools/cmakev2/component.cmake b/tools/cmakev2/component.cmake index d6de43ed98f..a3bf07c7b16 100644 --- a/tools/cmakev2/component.cmake +++ b/tools/cmakev2/component.cmake @@ -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