mirror of
https://github.com/xiph/opus.git
synced 2025-06-04 01:27:42 +00:00
cmake - make package version parsing more robust
Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
This commit is contained in:
parent
06a651547f
commit
6adac61a1e
1 changed files with 6 additions and 1 deletions
|
@ -44,7 +44,7 @@ endfunction()
|
|||
|
||||
function(get_package_version PACKAGE_VERSION)
|
||||
find_package(Git)
|
||||
if(GIT_FOUND)
|
||||
if(Git_FOUND AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/.git")
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --match "v*"
|
||||
OUTPUT_VARIABLE OPUS_PACKAGE_VERSION)
|
||||
if(OPUS_PACKAGE_VERSION)
|
||||
|
@ -80,6 +80,11 @@ function(get_package_version PACKAGE_VERSION)
|
|||
""
|
||||
opus_package_version_string
|
||||
${opus_package_version_string})
|
||||
# In case we have a unknown dist here we just replace it with 0
|
||||
string(REPLACE "unknown"
|
||||
"0"
|
||||
opus_package_version_string
|
||||
${opus_package_version_string})
|
||||
set(PACKAGE_VERSION ${opus_package_version_string} PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue