esp-idf/tools/cmake/run_dfu_util.cmake
Djordje Nedic facab8c5a7 tools: Increase the minimal supported CMake version to 3.16
This updates the minimal supported version of CMake to 3.16, which in turn enables us to use more CMake features and have a cleaner build system.
This is the version that provides most new features and also the one we use in our latest docker image for CI.
2022-06-01 06:35:02 +00:00

29 lines
717 B
CMake

# A CMake script to run dfu-util from within ninja or make
# or another cmake-based build runner
#
# It is recommended to NOT USE this CMake script directly
cmake_minimum_required(VERSION 3.16)
set(TOOL "dfu-util")
set(CMD "${TOOL}")
if(${ESP_DFU_LIST})
list(APPEND CMD "--list")
else()
# The following works even when ESP_DFU_PID is not defined.
list(APPEND CMD "-d" "303a:${ESP_DFU_PID}")
if(NOT $ENV{ESP_DFU_PATH} STREQUAL "")
list(APPEND CMD "--path" $ENV{ESP_DFU_PATH})
endif()
list(APPEND CMD "-D" ${ESP_DFU_BIN})
endif()
message("Command list: ${CMD}")
execute_process(COMMAND ${CMD} RESULT_VARIABLE result)
if(${result})
message(FATAL_ERROR "${TOOL} failed")
endif()