Skip to content

Commit d9416e7

Browse files
committed
CMAKE: update logic to fetch EOS version in debug builds
1 parent c51e759 commit d9416e7

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

cmake/EosUtils.cmake

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,24 @@ function(EOS_GetVersion MAJOR MINOR PATCH RELEASE)
6363
if(NOT VERSION_INFO_RESULT EQUAL 0)
6464
set(VERSION_ERR_MSG "Error getting EOS version info using `${CMAKE_SOURCE_DIR}/genversion.sh`")
6565
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
66-
# for debug builds, we allow to continue with a dummy version
66+
# for debug builds we take version from cache if available otherwise use a dummy version
6767
message(WARNING "${VERSION_ERR_MSG}")
68-
set(VERSION_INFO "0.0.0-unknown")
68+
if(NOT DEFINED VERSION_INFO_FROM_CACHE)
69+
# use a placeholder version (might need to be updated in the future)
70+
set(VERSION_INFO "5.3.27-unknown")
71+
else()
72+
message(WARNING "Using cached EOS version info for debug build: ${VERSION_INFO_FROM_CACHE}")
73+
set(VERSION_INFO "${VERSION_INFO_FROM_CACHE}")
74+
endif()
6975
message(WARNING "Setting EOS version to ${VERSION_INFO} for debug build")
7076
else()
7177
message(FATAL_ERROR "${VERSION_ERR_MSG}")
7278
endif()
79+
else()
80+
message(VERBOSE "Detected EOS version: ${VERSION_INFO}")
81+
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
82+
set(VERSION_INFO_FROM_CACHE "${VERSION_INFO}" CACHE INTERNAL "Cached EOS version info for debug builds")
83+
endif()
7384
endif()
7485

7586
string(REPLACE "." ";" VERSION_LIST ${VERSION_INFO})

0 commit comments

Comments
 (0)