Skip to content
Snippets Groups Projects
Verified Commit 6adac61a authored by Marcus Asteborg's avatar Marcus Asteborg Committed by Jean-Marc Valin
Browse files

cmake - make package version parsing more robust

parent 06a65154
No related branches found
No related tags found
No related merge requests found
...@@ -44,7 +44,7 @@ endfunction() ...@@ -44,7 +44,7 @@ endfunction()
function(get_package_version PACKAGE_VERSION) function(get_package_version PACKAGE_VERSION)
find_package(Git) 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*" execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --match "v*"
OUTPUT_VARIABLE OPUS_PACKAGE_VERSION) OUTPUT_VARIABLE OPUS_PACKAGE_VERSION)
if(OPUS_PACKAGE_VERSION) if(OPUS_PACKAGE_VERSION)
...@@ -80,6 +80,11 @@ function(get_package_version PACKAGE_VERSION) ...@@ -80,6 +80,11 @@ function(get_package_version PACKAGE_VERSION)
"" ""
opus_package_version_string opus_package_version_string
${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) set(PACKAGE_VERSION ${opus_package_version_string} PARENT_SCOPE)
return() return()
endif() endif()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment