Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Asteborg <maastebo@microsoft.com>2020-04-14 09:05:27 +0300
committerJean-Marc Valin <jmvalin@jmvalin.ca>2020-04-21 05:47:55 +0300
commit6adac61a1e329e9296754c56f437f6ea9df1fedf (patch)
treed65abd0fd2e4fa90f8d5371dc2c12777d8145010
parent06a651547f4a197c29b6abc23b530833855ee358 (diff)
cmake - make package version parsing more robust
Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
-rw-r--r--opus_functions.cmake7
1 files changed, 6 insertions, 1 deletions
diff --git a/opus_functions.cmake b/opus_functions.cmake
index fe309c2c..727601c4 100644
--- a/opus_functions.cmake
+++ b/opus_functions.cmake
@@ -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()