ref: 6adac61a1e329e9296754c56f437f6ea9df1fedf
parent: 06a651547f4a197c29b6abc23b530833855ee358
author: Marcus Asteborg <maastebo@microsoft.com>
date: Mon Apr 13 19:05:27 EDT 2020
cmake - make package version parsing more robust Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
--- a/opus_functions.cmake
+++ b/opus_functions.cmake
@@ -44,7 +44,7 @@
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)
@@ -78,6 +78,11 @@
${opus_package_version_string})
string(REPLACE "\""
""
+ 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)