Skip to content

Commit

Permalink
Merge pull request #1576 from heinezen/fix/version-display
Browse files Browse the repository at this point in the history
Allow non-annotated tags from git for setting version
  • Loading branch information
TheJJ authored Oct 15, 2023
2 parents 401f6a0 + 20e9b94 commit db164ef
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions buildsystem/DetectProjectVersion.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ endif()
if(IS_DIRECTORY "${CMAKE_SOURCE_DIR}/.git")
message(STATUS "Set PROJECT_VERSION from git.")
execute_process(
COMMAND git describe
COMMAND git describe --tags
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE _RES
OUTPUT_VARIABLE PROJECT_VERSION
Expand All @@ -30,8 +30,8 @@ set(PROJECT_VERSION_FILE "${CMAKE_SOURCE_DIR}/openage_version")
if(EXISTS ${PROJECT_VERSION_FILE})
file(STRINGS ${PROJECT_VERSION_FILE} FILE_DESCRIBE_VERSION)

STRING(REGEX REPLACE "v([0-9]+\\.[0-9]+\\.[0-9]+)"
"\\1" PROJECT_VERSION "${FILE_DESCRIBE_VERSION}")
STRING(REGEX REPLACE "([0-9]+\\.[0-9]+\\.[0-9]+)"
"\\1" PROJECT_VERSION "${FILE_DESCRIBE_VERSION}")
endif()

# Still could not detect the version. Don't worry, raise a warning (shout a curse word?) and move on.
Expand Down

0 comments on commit db164ef

Please sign in to comment.