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".
This commit is contained in:
Sudeep Mohanty
2026-06-29 22:10:21 +08:00
committed by BOT
parent 4825985844
commit e23b1f585f
+3 -1
View File
@@ -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}")