Ensure execute_process is error checked

Check the return value from execute_process calls and fail
with an appropriate message.

This makes debugging of cmake failures much easier.

Signed-off-by: Ben Leslie <benno@brkawy.com>
This commit is contained in:
Ben Leslie
2021-01-19 01:12:48 +00:00
committed by Kent McLeod
parent 502dec1cd3
commit e11ef82663
2 changed files with 24 additions and 1 deletions

View File

@@ -135,14 +135,22 @@ if(DEFINED KernelDTSList AND (NOT "${KernelDTSList}" STREQUAL ""))
execute_process(
COMMAND
${DTC_TOOL} -q -I dts -O dtb -o ${KernelDTBPath} ${KernelDTSIntermediate}
RESULT_VARIABLE error
)
if(error)
message(FATAL_ERROR "Failed to compile DTS to DTB: ${KernelDTBPath}")
endif()
# Track the size of the DTB for downstream tools
execute_process(
COMMAND
${STAT_TOOL} -c '%s' ${KernelDTBPath}
OUTPUT_VARIABLE KernelDTBSize
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE error
)
if(error)
message(FATAL_ERROR "Failed to determine KernelDTBSize: ${KernelDTBPath}")
endif()
string(
REPLACE
"\'"