Is it possible to set MCUBOOT_IMAGE_VERSION from CMake?

Hi!

I am trying to streamline development a bit and want to set my image version based on the latest git tag and commits since then and I have a script that extracts that information and I print the correct message in CMakeLists.txt.

My issue is when I try to set the CONFIG_MCUBOOT_IMAGE_VERSION, it does not seem to be picked up and my version always ends as 0.0.0+0. Setting it from the command line does work. Relevant CMake lines follows:

set(CONF_FILE prj.conf thing.conf mcuboot.conf)

message("Building image version ${IMAGE_VERSION}")

set(CONFIG_MCUBOOT_IMAGE_VERSION \\"${IMAGE_VERSION}\\")
set(mcuboot_CONFIG_MCUBOOT_IMAGE_VERSION \\"${IMAGE_VERSION}\\")

Now I do all this before I call the find_package(Zephyr) and project commands and I manage to set other variables, like the signing key for MCUBoot.

I am using SDK version 1.9.1

Related