fix(update): report the newest known version, not just the compiled one

Trusting the version compiled into the binary alone made the app report a stale
release whenever the build predated a version bump: `version` is read at
configure time, and bumping it is not by itself a reason to configure again, so
`cmake --build` kept the previous number compiled in while the marker it
installed next to the binary said otherwise. The update was then offered again
even though it had just been applied.

The version file is now a configure dependency, so a bump reconfigures the
build, and the reported version is the newest of the two sources, so neither
side can drag the app backwards.

Generated with Codebuff 🤖
Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
BlackAngelTV committed 2026-09-12 23:05:23 +02:00
1 parent fb5c11e153
commit 5216480d81
6 files changed
+75 -31

No files matched your search

+8 -3
View File
@@ -8,12 +8,17 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
# The repo-root `version` file is the single source of truth for release
# versioning. It is compiled into the binaries as well as installed next to
# them, so a running app always reports the release it was built from instead
# of trusting a `version` file that an update may have left stale.
# versioning. It is read at configure time and compiled into the binaries, so a
# running app knows which release it was built from.
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/version PACMANAGER_VERSION)
string(STRIP "${PACMANAGER_VERSION}" PACMANAGER_VERSION)
# Reading it above only happens during configuration, and bumping the file is
# not otherwise a reason to configure again: without this, `cmake --build` after
# a version bump kept building the previous version into the binary.
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/version)
# Find Qt6
find_package(Qt6 REQUIRED COMPONENTS Widgets Network)