From b0143352634ba7ed29f1db6ea576c0abfd0b4a29 Mon Sep 17 00:00:00 2001 From: Petr Hosek Date: Thu, 21 Jan 2021 00:01:18 -0800 Subject: [PATCH] [libc] Distinguish compiler and run failures This is useful for debugging issues, for example when cross-compiling. Differential Revision: https://reviews.llvm.org/D95118 --- libc/cmake/modules/LLVMLibCCheckCpuFeatures.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libc/cmake/modules/LLVMLibCCheckCpuFeatures.cmake b/libc/cmake/modules/LLVMLibCCheckCpuFeatures.cmake index 86c3822..57dfbd9 100644 --- a/libc/cmake/modules/LLVMLibCCheckCpuFeatures.cmake +++ b/libc/cmake/modules/LLVMLibCCheckCpuFeatures.cmake @@ -115,12 +115,14 @@ function(_check_defined_cpu_feature output_var) COMPILE_DEFINITIONS ${flags} COMPILE_OUTPUT_VARIABLE compile_output RUN_OUTPUT_VARIABLE run_output) - if(${compile_result} AND ("${run_result}" EQUAL 0)) + if("${run_result}" EQUAL 0) set(${output_var} "${run_output}" PARENT_SCOPE) + elseif(NOT ${compile_result}) + message(FATAL_ERROR "Failed to compile: ${compile_output}") else() - message(FATAL_ERROR "${compile_output}") + message(FATAL_ERROR "Failed to run: ${run_output}") endif() endfunction() -- 2.7.4