From 5e539890f16046309db419d2825532fe7c8e3313 Mon Sep 17 00:00:00 2001 From: Petru Conduraru Date: Mon, 6 Jul 2026 09:09:11 +0300 Subject: [PATCH] buildinfo: report the release version instead of a hardcoded fallback #8164 When ADD_COMMIT_SHA is off (the default for release tarballs), buildinfo.cpp fell back to a hardcoded "0.8.0", so a 0.8.5/0.8.6 build reported 0.8.0 from IfcConvert --version and in written file headers. Pass CMake's RELEASE_VERSION (read from the VERSION file) to IfcParse as IFCOPENSHELL_VERSION_STRING and use it as the fallback, mirroring how the branch/commit defines are handled. The commit-sha build and the last-resort literal are unchanged. Co-Authored-By: Claude Fable 5 --- cmake/CMakeLists.txt | 5 +++++ src/ifcparse/buildinfo.cpp | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index baafc5c459..773fa6ab61 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -660,6 +660,11 @@ if(ADD_COMMIT_SHA) endif() endif(ADD_COMMIT_SHA) +# Always expose the release version (from the VERSION file) to buildinfo.cpp so +# that a build without commit-sha info reports the correct version instead of a +# stale hardcoded fallback. See #8164. +target_compile_definitions(IfcParse PRIVATE IFCOPENSHELL_VERSION_STRING=${RELEASE_VERSION}) + if(MSVC) # @todo still needs to be understood better, but the cgal and cgal-simple kernel cause multiply defined boost lambda placeholders _1 ... _3 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /FORCE:MULTIPLE") diff --git a/src/ifcparse/buildinfo.cpp b/src/ifcparse/buildinfo.cpp index 0785712e2e..26375d7a12 100644 --- a/src/ifcparse/buildinfo.cpp +++ b/src/ifcparse/buildinfo.cpp @@ -30,6 +30,10 @@ #if defined(IFCOPENSHELL_BRANCH) && defined(IFCOPENSHELL_COMMIT) const char *IFCOPENSHELL_VERSION = STRINGIFY(IFCOPENSHELL_BRANCH) "-" STRINGIFY(IFCOPENSHELL_COMMIT); +#elif defined(IFCOPENSHELL_VERSION_STRING) +// Set from CMake's RELEASE_VERSION (the repository VERSION file) so a release +// build without commit-sha info still reports the correct version. See #8164. +const char *IFCOPENSHELL_VERSION = STRINGIFY(IFCOPENSHELL_VERSION_STRING); #else const char *IFCOPENSHELL_VERSION = "0.8.0"; #endif