From 16ff9050a3d4c840fed6e700441f5bb8a552f7a8 Mon Sep 17 00:00:00 2001 From: haonanya Date: Tue, 25 Jan 2022 16:29:12 +0800 Subject: [PATCH] Exit CMake processing when apply patch failed (#306) * Exit CMake processing when apply patch failed Signed-off-by: haonanya * Skip the rest when apply patch failed Signed-off-by: haonanya --- cmake/modules/CMakeFunctions.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmake/modules/CMakeFunctions.cmake b/cmake/modules/CMakeFunctions.cmake index 9a824792..5a49ac01 100644 --- a/cmake/modules/CMakeFunctions.cmake +++ b/cmake/modules/CMakeFunctions.cmake @@ -146,8 +146,12 @@ function(apply_patches repo_dir patches_dirs base_revision target_branch ret) WORKING_DIRECTORY ${repo_dir} OUTPUT_VARIABLE patching_log ERROR_QUIET + RESULT_VARIABLE ret_apply_patch ) message(STATUS "[OPENCL-CLANG] Not present - ${patching_log}") + if (ret_apply_patch) + break() + endif() endif() endforeach(patch) else() # The target branch already exists @@ -161,6 +165,8 @@ function(apply_patches repo_dir patches_dirs base_revision target_branch ret) endif() if (NOT (ret_not_git_repo OR ret_check_out OR ret_apply_patch)) set(${ret} True PARENT_SCOPE) + else() + message(FATAL_ERROR "[OPENCL-CLANG] Failed to apply patch!") endif() endfunction()