diff options
author | Jonathan "Geenz" Goodman <geenz@geenzo.com> | 2023-03-31 10:54:22 -0700 |
---|---|---|
committer | Jonathan "Geenz" Goodman <geenz@geenzo.com> | 2023-03-31 10:54:22 -0700 |
commit | 4e306c90666094a7450f4d6f3ed7c8b71527e393 (patch) | |
tree | 4e52cfe3cfc7df8060ec5336f53d91636986b43c /indra/cmake/BuildVersion.cmake | |
parent | b44ad50f75724a5d9e53bd52d2724111568caf24 (diff) | |
parent | 7d144fcb2a1b0aff1b59e378c652649c3d03e94f (diff) |
Merge branch 'DRTVWR-559' of https://github.com/secondlife/viewer into DRTVWR-559
Diffstat (limited to 'indra/cmake/BuildVersion.cmake')
-rw-r--r-- | indra/cmake/BuildVersion.cmake | 44 |
1 files changed, 17 insertions, 27 deletions
diff --git a/indra/cmake/BuildVersion.cmake b/indra/cmake/BuildVersion.cmake index 157fdd07e4..b531f29ee2 100644 --- a/indra/cmake/BuildVersion.cmake +++ b/indra/cmake/BuildVersion.cmake @@ -19,33 +19,23 @@ if (NOT DEFINED VIEWER_SHORT_VERSION) # will be true in indra/, false in indra/n message(STATUS "Revision (from autobuild environment): ${VIEWER_VERSION_REVISION}") else (DEFINED ENV{revision}) - find_program(MERCURIAL - NAMES hg - PATHS [HKEY_LOCAL_MACHINE\\Software\\TortoiseHG] - PATH_SUFFIXES Mercurial) - mark_as_advanced(MERCURIAL) - if (MERCURIAL) - execute_process(COMMAND ${MERCURIAL} identify --num --rev tip - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - RESULT_VARIABLE hg_id_result - ERROR_VARIABLE hg_id_error - OUTPUT_VARIABLE VIEWER_VERSION_REVISION - OUTPUT_STRIP_TRAILING_WHITESPACE) - if (NOT ${hg_id_result} EQUAL 0) - message(SEND_ERROR "Revision number generation failed with output:\n${hg_id_error}") - else (NOT ${hg_id_result} EQUAL 0) - string(REGEX REPLACE "[^0-9a-f]" "" VIEWER_VERSION_REVISION ${VIEWER_VERSION_REVISION}) - endif (NOT ${hg_id_result} EQUAL 0) - if ("${VIEWER_VERSION_REVISION}" MATCHES "^[0-9]+$") - message(STATUS "Revision (from hg) ${VIEWER_VERSION_REVISION}") - else ("${VIEWER_VERSION_REVISION}" MATCHES "^[0-9]+$") - message(STATUS "Revision not set (repository not found?); using 0") - set(VIEWER_VERSION_REVISION 0 ) - endif ("${VIEWER_VERSION_REVISION}" MATCHES "^[0-9]+$") - else (MERCURIAL) - message(STATUS "Revision not set: mercurial not found; using 0") - set(VIEWER_VERSION_REVISION 0) - endif (MERCURIAL) + find_program(GIT git) + if (DEFINED GIT ) + execute_process( + COMMAND ${GIT} rev-list --count HEAD + OUTPUT_VARIABLE VIEWER_VERSION_REVISION + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if ("${VIEWER_VERSION_REVISION}" MATCHES "^[0-9]+$") + message(STATUS "Revision (from git) ${VIEWER_VERSION_REVISION}") + else ("${VIEWER_VERSION_REVISION}" MATCHES "^[0-9]+$") + message(STATUS "Revision not set (repository not found?); using 0") + set(VIEWER_VERSION_REVISION 0 ) + endif ("${VIEWER_VERSION_REVISION}" MATCHES "^[0-9]+$") + else (DEFINED GIT ) + message(STATUS "Revision not set: 'git' found; using 0") + set(VIEWER_VERSION_REVISION 0) + endif (DEFINED GIT) endif (DEFINED ENV{revision}) message(STATUS "Building '${VIEWER_CHANNEL}' Version ${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}") else ( EXISTS ${VIEWER_VERSION_BASE_FILE} ) |