From cbfc37cde6fd39aea3370cf1918f825f1e2ea74b Mon Sep 17 00:00:00 2001 From: Ben Nicholson Date: Thu, 24 Sep 2026 23:17:13 +1000 Subject: [PATCH] Rebuild picks up the git version after each commit PROJECT_VER was only read at CMake configure time, so builds kept the previous commit's version. CMake now re-runs when .git/logs/HEAD or .git/index change. Needed for OTA tests (step 2b), which rely on the version changing between builds. Co-Authored-By: Claude Opus 5.5 --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e50d9c..2cae49d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,11 @@ cmake_minimum_required(VERSION 3.16) # Firmware version = git describe (tags, dirty flag). Reported by esp_app_get_description() -# and in status.fw / GET /api/ota. Re-run cmake (idf.py reconfigure) to pick up a new tag. +# and in status.fw / GET /api/ota. CMake re-runs when git's HEAD log or index changes (commit, +# checkout, add), so the version follows. A new tag or unstaged edits need `idf.py reconfigure`. +set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS + ${CMAKE_CURRENT_LIST_DIR}/.git/logs/HEAD + ${CMAKE_CURRENT_LIST_DIR}/.git/index) execute_process( COMMAND git describe --tags --always --dirty WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}