From 963f1cb84dc62b9bc2ade12013d55a3b03571327 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Fri, 14 Jun 2019 16:47:04 +0000 Subject: [PATCH] build: don't attempt to run config.guess on Windows When cross-compiling LLVM to android from Windows (for LLVMSupport), we would attempt to execute `config.guess` to determine the host triple since `CMAKE_SYSTEM_NAME` is not Windows and `CMAKE_C_COMPILER` will be set to GNU or Clang. This will fail as `config.guess` is a shell script which cannot be executed on Windows. Simply log a warning instead. The user can specify the value for this instead in those cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363420 91177308-0d34-0410-b5e6-96231b3b80d8 --- cmake/modules/GetHostTriple.cmake | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/cmake/modules/GetHostTriple.cmake b/cmake/modules/GetHostTriple.cmake index 9a74ad6c04a..463a79fc10c 100644 --- a/cmake/modules/GetHostTriple.cmake +++ b/cmake/modules/GetHostTriple.cmake @@ -15,16 +15,20 @@ function( get_host_triple var ) set( value "i686-pc-windows-gnu" ) endif() else( MSVC ) - set(config_guess ${LLVM_MAIN_SRC_DIR}/cmake/config.guess) - execute_process(COMMAND sh ${config_guess} - RESULT_VARIABLE TT_RV - OUTPUT_VARIABLE TT_OUT - OUTPUT_STRIP_TRAILING_WHITESPACE) - if( NOT TT_RV EQUAL 0 ) - message(FATAL_ERROR "Failed to execute ${config_guess}") - endif( NOT TT_RV EQUAL 0 ) - # Defer to dynamic detection of the host AIX version. - string(REGEX REPLACE "-aix[0-9][^-]*" "-aix" value ${TT_OUT}) + if(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows) + message(WARNING "unable to determine host target triple") + else() + set(config_guess ${LLVM_MAIN_SRC_DIR}/cmake/config.guess) + execute_process(COMMAND sh ${config_guess} + RESULT_VARIABLE TT_RV + OUTPUT_VARIABLE TT_OUT + OUTPUT_STRIP_TRAILING_WHITESPACE) + if( NOT TT_RV EQUAL 0 ) + message(FATAL_ERROR "Failed to execute ${config_guess}") + endif( NOT TT_RV EQUAL 0 ) + # Defer to dynamic detection of the host AIX version. + string(REGEX REPLACE "-aix[0-9][^-]*" "-aix" value ${TT_OUT}) + endif() endif( MSVC ) set( ${var} ${value} PARENT_SCOPE ) endfunction( get_host_triple var ) -- 2.11.0