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 <karolx.trzcinski@linux.intel.com>
This commit is contained in:
Karol Trzcinski 2020-08-31 10:44:43 +02:00 committed by Liam Girdwood
parent 67e41d21c3
commit b2a325a3b7
1 changed files with 5 additions and 1 deletions

View File

@ -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()