From b2a325a3b7e66e9eff0068c6d6302b2f1afffb01 Mon Sep 17 00:00:00 2001 From: Karol Trzcinski Date: Mon, 31 Aug 2020 10:44:43 +0200 Subject: [PATCH] cmake: Handle empty SOF_SRC_HASH_LONG SOF_SRC_HASH always must have integer value, because of usage them to initialize global variable in source code. Variables, which may be empty should be used inside quotation to prevent cmake incorect number of arguments error. Signed-off-by: Karol Trzcinski --- scripts/cmake/version.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/cmake/version.cmake b/scripts/cmake/version.cmake index 2f3cd63c9..9d234963f 100644 --- a/scripts/cmake/version.cmake +++ b/scripts/cmake/version.cmake @@ -84,7 +84,11 @@ if(EXISTS ${SOF_ROOT_SOURCE_DIRECTORY}/.git/) string(SUBSTRING ${SOF_SRC_HASH_LONG} 0 8 SOF_SRC_HASH) message(STATUS "Source content hash: ${SOF_SRC_HASH}") else() - string(SUBSTRING ${GIT_LOG_HASH} 0 8 SOF_SRC_HASH) + if("${GIT_LOG_HASH}") + string(SUBSTRING "${GIT_LOG_HASH}" 0 8 SOF_SRC_HASH) + else() + set(SOF_SRC_HASH "0") + endif() message(WARNING "Source content hash not computed without git, using GIT_LOG_HASH instead") endif()