[llvm] r363420 - build: don't attempt to run config.guess on Windows

Saleem Abdulrasool via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 14 09:47:04 PDT 2019


Author: compnerd
Date: Fri Jun 14 09:47:04 2019
New Revision: 363420

URL: http://llvm.org/viewvc/llvm-project?rev=363420&view=rev
Log:
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.

Modified:
    llvm/trunk/cmake/modules/GetHostTriple.cmake

Modified: llvm/trunk/cmake/modules/GetHostTriple.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/GetHostTriple.cmake?rev=363420&r1=363419&r2=363420&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/GetHostTriple.cmake (original)
+++ llvm/trunk/cmake/modules/GetHostTriple.cmake Fri Jun 14 09:47:04 2019
@@ -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 )




More information about the llvm-commits mailing list