aboutsummaryrefslogtreecommitdiffstats
path: root/host/cmake/Modules/UHDVersion.cmake
diff options
context:
space:
mode:
authorAshish Chaudhari <ashish@ettus.com>2016-05-26 09:20:59 -0700
committerAshish Chaudhari <ashish@ettus.com>2016-05-26 09:20:59 -0700
commit9046188eb890a2b6dcb813fb365b2a863f94529d (patch)
tree736da7a550fe9b0036e4cca410665aff11a688a2 /host/cmake/Modules/UHDVersion.cmake
parentf34e0beab103ff21315c7d417a68501a7722ef7d (diff)
parentbf74b4e85d6d2b8833c35b1f243eb36b99432250 (diff)
downloaduhd-9046188eb890a2b6dcb813fb365b2a863f94529d.tar.gz
uhd-9046188eb890a2b6dcb813fb365b2a863f94529d.tar.bz2
uhd-9046188eb890a2b6dcb813fb365b2a863f94529d.zip
Merge branch 'maint'
Diffstat (limited to 'host/cmake/Modules/UHDVersion.cmake')
-rw-r--r--host/cmake/Modules/UHDVersion.cmake15
1 files changed, 13 insertions, 2 deletions
diff --git a/host/cmake/Modules/UHDVersion.cmake b/host/cmake/Modules/UHDVersion.cmake
index 74066e368..2b105585b 100644
--- a/host/cmake/Modules/UHDVersion.cmake
+++ b/host/cmake/Modules/UHDVersion.cmake
@@ -107,16 +107,27 @@ EXECUTE_PROCESS(
IF(_git_describe_result EQUAL 0)
EXECUTE_PROCESS(
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- COMMAND ${PYTHON_EXECUTABLE} -c "print('${_git_describe}'.split('-')[-2])"
+ COMMAND ${PYTHON_EXECUTABLE} -c "
+try:
+ print('${_git_describe}'.split('-')[-2])
+except IndexError:
+ print('0')
+"
OUTPUT_VARIABLE UHD_GIT_COUNT OUTPUT_STRIP_TRAILING_WHITESPACE
)
EXECUTE_PROCESS(
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- COMMAND ${PYTHON_EXECUTABLE} -c "print('${_git_describe}'.split('-')[-1])"
+ COMMAND ${PYTHON_EXECUTABLE} -c "
+try:
+ print('${_git_describe}'.split('-')[-1])
+except IndexError:
+ print('unknown')
+"
OUTPUT_VARIABLE UHD_GIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE
)
ENDIF()
+## Set default values if all fails. Make sure they're identical to the ones above.
IF(NOT UHD_GIT_COUNT)
SET(UHD_GIT_COUNT "0")
ENDIF()