mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-06 07:51:47 +00:00
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 <noreply@anthropic.com>
This commit is contained in:
committed by
Thomas Krijnen
parent
7322263a5e
commit
b2d58d0b81
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user