Skip to content

Commit 21d9987

Browse files
valeriosettiJeppe Odgaard
authored andcommitted
cmake: modules: dts: print error message if DTC fails
Currently stderr is printed only if dtc encounters warnings, but it's not printed in case of errors. However this information can be useful to quickly identify and resolve the problem. To solve this let's add "COMMAND_ERROR_IS_FATAL ANY" to execute_process() so that CMake will fail in case of errors and a proper message will be printed on the output. Signed-off-by: Valerio Setti <[email protected]>
1 parent b41b69e commit 21d9987

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

cmake/modules/dts.cmake

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -413,17 +413,9 @@ execute_process(
413413
${ZEPHYR_DTS}
414414
OUTPUT_QUIET # Discard stdout
415415
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
416-
RESULT_VARIABLE ret
417-
ERROR_VARIABLE stderr
416+
COMMAND_ERROR_IS_FATAL ANY
418417
)
419418

420-
if(NOT "${ret}" STREQUAL "0")
421-
message(FATAL_ERROR "dtc failed with return code: ${ret}")
422-
elseif(stderr)
423-
# dtc printed warnings on stderr but did not fail.
424-
# Display them as CMake warnings to draw attention.
425-
message(WARNING "dtc raised one or more warnings:\n${stderr}")
426-
endif()
427419
endif(DTC)
428420

429421
build_info(devicetree files PATH ${dts_files})

0 commit comments

Comments
 (0)