Skip to content

Commit

Permalink
build: Append git describe to version string
Browse files Browse the repository at this point in the history
  • Loading branch information
kanru committed Jul 21, 2024
1 parent d2e1118 commit fabe755
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@ cmake_minimum_required(VERSION 3.24.0)
project(libchewing LANGUAGES C)

set(CMAKE_PROJECT_VERSION 0.9.0-rc.2)

find_package(Git)
if(Git_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} --work-tree ${CMAKE_SOURCE_DIR} describe --dirty --always
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE GIT_DESCRIBE
ERROR_VARIABLE GIT_DESCRIBE_ERROR
)
if(NOT GIT_DESCRIBE_ERROR)
string(REPLACE "v" "" CMAKE_PROJECT_VERSION ${GIT_DESCRIBE})
endif()
endif()

set(LIBCHEWING_VERSION ${CMAKE_PROJECT_VERSION})
set(PACKAGE_VERSION ${CMAKE_PROJECT_VERSION})
set(LIBCHEWING_BINARY_VERSION 1.0.0)
Expand Down

0 comments on commit fabe755

Please sign in to comment.