From b2d58d0b812f93b64c5b56bd3fd67057138d51d0 Mon Sep 17 00:00:00 2001 From: Petru Conduraru Date: Mon, 6 Jul 2026 22:06:42 +0300 Subject: [PATCH] cmake: read the VERSION file unconditionally so builds report the real version #8164 IfcConvert --version reported 0.8.0 on a plain source build even though the VERSION file says 0.8.6 (#8164). buildinfo.cpp already falls back to the IFCOPENSHELL_VERSION_STRING macro and CMake already passes it as ${RELEASE_VERSION}, but RELEASE_VERSION was only read from the VERSION file when VERSION_OVERRIDE was on. A default build (VERSION_OVERRIDE off, ADD_COMMIT_SHA off, as the nixpkgs package builds it) fell through to the hardcoded "0.8.0", so the fallback macro carried the stale value. Read the VERSION file unconditionally so RELEASE_VERSION is always the real version. VERSION_OVERRIDE still governs the branch name embedded when ADD_COMMIT_SHA is on, and project()/CPack now also reflect the true version. Co-Authored-By: Claude Opus 4.8 --- cmake/CMakeLists.txt | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 773fa6ab61..f16b40c447 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -27,13 +27,14 @@ endif() set(CMAKE_CXX_STANDARD_REQUIRED ON) # not necessary, but encouraged set(CMAKE_EXPORT_COMPILE_COMMANDS ON) -if(VERSION_OVERRIDE) - file(READ "../VERSION" "RELEASE_VERSION_") - string(STRIP "${RELEASE_VERSION_}" RELEASE_VERSION) - message(STATUS "Detected version '${RELEASE_VERSION}'") -else() - set(RELEASE_VERSION "0.8.0") -endif() +# The VERSION file in the repository root is the single source of truth for the +# release version. Read it unconditionally so a plain source build reports the +# real version through buildinfo.cpp instead of the stale hardcoded 0.8.0 +# fallback (see #8164). VERSION_OVERRIDE still controls the branch name used +# when ADD_COMMIT_SHA embeds a commit sha. +file(READ "../VERSION" "RELEASE_VERSION_") +string(STRIP "${RELEASE_VERSION_}" RELEASE_VERSION) +message(STATUS "Detected version '${RELEASE_VERSION}'") add_definitions(-D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR)