Re: Executing a Post Build Batch File using CMake


mlsvrts
 

Hi Casey,

I have been using `add_custom_command` to sign my generated images like this:

set(ZEPHYR_SIGNED_BIN ${ZEPHYR_BINARY_DIR}/zephyr.signed.bin)
set(MCUBOOT_SIGNING_KEY ${ZEPHYR_BASE}/../bootloader/mcuboot/root-rsa-2048.pem)
set(APP_VERSION 1.0.5+2)

add_custom_command(
    COMMAND west sign -t imgtool --
        --key ${MCUBOOT_SIGNING_KEY}
        --version ${APP_VERSION}
    OUTPUT ${ZEPHYR_SIGNED_BIN}
    DEPENDS zephyr_final
    COMMENT "Running post-build signing step..."
)

add_custom_target(
    post_bin ALL
    DEPENDS
    ${ZEPHYR_SIGNED_BIN}
)


Note that the command won't trigger without the additional `custom_target`. Also, my source directory is child of `zephyrproject/zephyr`, so I can't say for certain that this will work in your case.

- mlsvrts

Join users@lists.zephyrproject.org to automatically receive all group messages.