From e23b1f585f58f3401f76bec63d910dee062300f9 Mon Sep 17 00:00:00 2001 From: Sudeep Mohanty Date: Fri, 29 May 2026 17:10:17 +0200 Subject: [PATCH] fix(cmakev2): guard flash targets when esptool_py is excluded Add a COMMAND check on esptool_py_flash_target before invoking it in __init_project_flash_targets. Apps that restrict the build set without esptool_py would otherwise hit "Unknown CMake command". --- tools/cmakev2/project.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/cmakev2/project.cmake b/tools/cmakev2/project.cmake index 432f4282661..03e3fbcb351 100644 --- a/tools/cmakev2/project.cmake +++ b/tools/cmakev2/project.cmake @@ -533,7 +533,9 @@ endfunction() esptool_py component. #]] function(__init_project_flash_targets) - if(CONFIG_APP_BUILD_GENERATE_BINARIES) + # Skip if esptool_py is not in the build set; the flash-target function + # would otherwise be undefined. + if(CONFIG_APP_BUILD_GENERATE_BINARIES AND COMMAND esptool_py_flash_target) idf_component_get_property(main_args esptool_py FLASH_ARGS) idf_component_get_property(sub_args esptool_py FLASH_SUB_ARGS) esptool_py_flash_target(flash "${main_args}" "${sub_args}")