OSDN Git Service

build: don't attempt to run config.guess on Windows
authorSaleem Abdulrasool <compnerd@compnerd.org>
Fri, 14 Jun 2019 16:47:04 +0000 (16:47 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Fri, 14 Jun 2019 16:47:04 +0000 (16:47 +0000)
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

index 9a74ad6..463a79f 100644 (file)
@@ -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 )