[CodeGenPrepare] Handle all debug calls in dupRetToEnableTailCallOpts()
[llvm-complete.git] / cmake / modules / GetHostTriple.cmake
blob7b842450b726aefaa44377cb5e8212a66ec42668
1 # Returns the host triple.
2 # Invokes config.guess
4 function( get_host_triple var )
5   if( MSVC )
6     if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
7       set( value "x86_64-pc-windows-msvc" )
8     else()
9       set( value "i686-pc-windows-msvc" )
10     endif()
11   elseif( MINGW AND NOT MSYS )
12     if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
13       set( value "x86_64-w64-windows-gnu" )
14     else()
15       set( value "i686-pc-windows-gnu" )
16     endif()
17   else( MSVC )
18     set(config_guess ${LLVM_MAIN_SRC_DIR}/cmake/config.guess)
19     execute_process(COMMAND sh ${config_guess}
20       RESULT_VARIABLE TT_RV
21       OUTPUT_VARIABLE TT_OUT
22       OUTPUT_STRIP_TRAILING_WHITESPACE)
23     if( NOT TT_RV EQUAL 0 )
24       message(FATAL_ERROR "Failed to execute ${config_guess}")
25     endif( NOT TT_RV EQUAL 0 )
26     set( value ${TT_OUT} )
27   endif( MSVC )
28   set( ${var} ${value} PARENT_SCOPE )
29 endfunction( get_host_triple var )