Build Environment Details
- Building Zephyr with CMake
- ARM Platform (Nordic nrf5340)
- Source and Build directories are out of tree.
- My build directory is ${CMAKE_CURRENT_SOURCE_DIR}../../Executables
- My source directories are in several places, but all are in a sub-directory of ${CMAKE_CURRENT_SOURCE_DIR}/../../../../
- CLion is my IDE of choice but I don't believe that matters for this discusson.
What I am Trying to AchieveAt the end of my build process, I would like to execute a batch file on the zephyr_final target that signs the final image. This is different than the MCU Boot signature and is a custom proprietary signature. I am unable to change the way in which this image is signed as it must be compatible with existing tools used with my product.
Method in Which I am trying to AchieveNormally, I would do this using add_custom_command(TARGET target_name POST_BUILD
COMMAND "batchfile.bat" batchfile_arguments)
However, I don't believe that the final zephyr target is within the scope of the top-level CMakeLists.txt file. That said, I do not have a lot of experience with CMake as most of my past development was within the IAR toolchain. It's very possible that I am misinterpreting this.
Questions
1. Will I be able to use the add_custom_command() CMake function to execute the batch file? If so, can someone provide an example as to how I would do this and what Target I should be using.
2. Is there a better, more appropriate method for doing this within the Zephyr environment.
Any help or guidance is much appreciated!