Custom command or (POST BUILD) run after build

VivekBorse
Posts: 4
Joined: Thu Nov 09, 2023 4:08 pm

Custom command or (POST BUILD) run after build

Postby VivekBorse » Fri Apr 26, 2024 9:16 am

Hi,
I want to run my custom command after POST BUILD
Below is a contain of my cmakeList.txt files

cmake_minimum_required(VERSION 3.16)

# This example uses an extra component for common functions such as Wi-Fi and Ethernet connection.
set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)

# Include ESP-IDF project configuration
include($ENV{IDF_PATH}/tools/cmake/project.cmake)

# Define your project
project(restful_server)

message(STATUS "CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}")
message(STATUS "IDF_PATH: ${IDF_PATH}")
# Retrieve the executable name
idf_build_get_property(BINARY_DIR/restful_server.bin EXECUTABLE)

# Add a custom post-build command
add_custom_command(
TARGET ${BINARY_DIR/restful_server.bin}
POST_BUILD
DEPENDS ${CMAKE_BINARY_DIR}/restful_server.bin ${CMAKE_BINARY_DIR}/www.bin

COMMAND echo "This is post build"
#COMMAND ${IDF_PATH}/export.bat
#COMMAND esptool.py --chip ESP32C6 merge_bin -o mergedFile-flash.bin 0x00 ${CMAKE_BINARY_DIR}/restful_server.bin 0x140000 ${CMAKE_BINARY_DIR}/www.bin
)


After build i got the result as Below
"This is post build"
esptool.py v4.7.0
Creating esp32c6 image...
Merged 3 ELF sections
Successfully created esp32c6 image.
Generated D:/ESP_ws/bw537_restful_server/build/restful_server.bin

i am able to see my print i.e "This is post build" but it should run after Generated D:/ESP_ws/bw537_restful_server/build/restful_server.bin

Who is online

Users browsing this forum: Bing [Bot] and 75 guests