Unverified Commit 6adac61a authored by Marcus Asteborg's avatar Marcus Asteborg Committed by Jean-Marc Valin
Browse files

cmake - make package version parsing more robust


Signed-off-by: Jean-Marc Valin's avatarJean-Marc Valin <jmvalin@jmvalin.ca>
parent 06a65154
......@@ -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()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment