Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ if(TD_COMMUNITY_STANDALONE)
set(BUILD_VER_TYPE "" CACHE STRING "Version type override (e.g. stable)")
set(BUILD_VER_DATE "" CACHE STRING "Version date override (e.g. %Y-%m-%d %H:%M:%S %z)")
set(BUILD_VER_CPUTYPE "" CACHE STRING "CPU type override")
set(BUILD_VER_OSTYPE "" CACHE STRING "OS type override")
if(DEFINED CACHE{BUILD_VER_OSTYPE} AND NOT "$CACHE{BUILD_VER_OSTYPE}" STREQUAL "")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The variable BUILD_VER_CPUTYPE suffers from the exact same shadowing and first-run clearing issue as BUILD_VER_OSTYPE. In cmake/platform.cmake, BUILD_VER_CPUTYPE is initialized as a normal variable (e.g., SET(BUILD_VER_CPUTYPE "x64")). Then, in cmake/options.cmake (line 15), it is declared as a cache variable: set(BUILD_VER_CPUTYPE "" CACHE STRING "CPU type override"). On the first configure run, this clears the normal variable, resulting in an empty BUILD_VER_CPUTYPE in version.cmake. On subsequent runs, the normal variable set by platform.cmake shadows any user-provided cache override (e.g., -DBUILD_VER_CPUTYPE=arm64). To resolve this, please apply the same robust pattern to BUILD_VER_CPUTYPE as well: if(DEFINED CACHE{BUILD_VER_CPUTYPE} AND NOT "$CACHE{BUILD_VER_CPUTYPE}" STREQUAL "") set(BUILD_VER_CPUTYPE "$CACHE{BUILD_VER_CPUTYPE}") else() set(BUILD_VER_CPUTYPE "${BUILD_VER_CPUTYPE}" CACHE STRING "CPU type override" FORCE) endif()

set(BUILD_VER_OSTYPE "$CACHE{BUILD_VER_OSTYPE}")
else()
set(BUILD_VER_OSTYPE "${BUILD_VER_OSTYPE}" CACHE STRING "OS type override" FORCE)
endif()
set(BUILD_GITINFO "" CACHE STRING "Git commit ID override")
set(BUILD_GITINFOI "" CACHE STRING "Internal git commit ID override")
endif()
Expand Down
Loading