Skip to content

Commit

Permalink
Update project.cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
octoflar authored Jun 26, 2024
1 parent 2993046 commit 7a40308
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/cmake/project.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,18 @@ function(project_url URL)
endfunction()

function(project_version_tag TAG)
if (${TAG} STREQUAL snapshot)
if (${TAG} STREQUAL GIT_HASH)
find_program(GIT git)
if (GIT)
execute_process(COMMAND ${GIT} rev-parse --short HEAD
OUTPUT_VARIABLE ID
OUTPUT_VARIABLE GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE STATUS
ERROR_QUIET)
if (${STATUS} EQUAL 0)
set(PROJECT_VERSION_TAG ${ID} PARENT_SCOPE)
set(PROJECT_VERSION_TAG ${GIT_HASH} PARENT_SCOPE)
else ()
set(PROJECT_VERSION_TAG "" PARENT_SCOPE)
endif ()
endif ()
else ()
Expand Down

0 comments on commit 7a40308

Please sign in to comment.