[PATCH] D22370: Respect LLVM_HOST_TRIPLE when manually specified

Chris Bieneman via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 15 10:46:04 PDT 2016


beanz added a comment.

Supporting specifying the triple manually is a completely separate issue from the bug you encountered. I'd prefer to make target detection for windows work correctly and reliably so that we don't need to support setting `LLVM_HOST_TRIPLE` manually. Other than the bugs in get_host_triple, is there a reason you feel the need to set the host triple manually?

You are right about using `CMAKE_CL_64`, we should instead use `CMAKE_SIZEOF_VOID_P`. So something more like:

  diff --git a/cmake/modules/GetHostTriple.cmake b/cmake/modules/GetHostTriple.cmake
  index 5de710c..f8c7bf1 100644
  --- a/cmake/modules/GetHostTriple.cmake
  +++ b/cmake/modules/GetHostTriple.cmake
  @@ -2,18 +2,18 @@
   # Invokes config.guess
   
   function( get_host_triple var )
  -  if( MSVC )
  -    if( CMAKE_CL_64 )
  -      set( value "x86_64-pc-win32" )
  -    else()
  -      set( value "i686-pc-win32" )
  -    endif()
  -  elseif( MINGW AND NOT MSYS )
  +  if( MINGW AND NOT MSYS )
       if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
         set( value "x86_64-w64-mingw32" )
       else()
         set( value "i686-pc-mingw32" )
       endif()
  +  elseif( CMAKE_HOST_WIN32 )
  +    if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
  +      set( value "x86_64-pc-win32" )
  +    else()
  +      set( value "i686-pc-win32" )
  +    endif()
     else( MSVC )
       set(config_guess ${LLVM_MAIN_SRC_DIR}/cmake/config.guess)
       execute_process(COMMAND sh ${config_guess}

-Chris


Repository:
  rL LLVM

https://reviews.llvm.org/D22370





More information about the llvm-commits mailing list