aboutsummaryrefslogtreecommitdiffstats
path: root/host/cmake
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2016-05-25 10:58:57 -0700
committerMartin Braun <martin.braun@ettus.com>2016-05-25 10:58:57 -0700
commit984a18a75bd73fecafa9050fbec7e8bf58ac3084 (patch)
tree7c2af8691590172275abaf9478b692bc57e3c71f /host/cmake
parent1aa5d7e2360d2d3d6e843ebe970cd89a9ecc3c0b (diff)
downloaduhd-984a18a75bd73fecafa9050fbec7e8bf58ac3084.tar.gz
uhd-984a18a75bd73fecafa9050fbec7e8bf58ac3084.tar.bz2
uhd-984a18a75bd73fecafa9050fbec7e8bf58ac3084.zip
cmake: When git describe fails, just use defaults instead of printing warnings.
Diffstat (limited to 'host/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 a344969d1..4b26efdb2 100644
--- a/host/cmake/Modules/UHDVersion.cmake
+++ b/host/cmake/Modules/UHDVersion.cmake
@@ -69,16 +69,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()