xref: /minix3/external/bsd/llvm/dist/llvm/cmake/modules/GetHostTriple.cmake (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc# Returns the host triple.
2*f4a2713aSLionel Sambuc# Invokes config.guess
3*f4a2713aSLionel Sambuc
4*f4a2713aSLionel Sambucfunction( get_host_triple var )
5*f4a2713aSLionel Sambuc  if( MSVC )
6*f4a2713aSLionel Sambuc    if( CMAKE_CL_64 )
7*f4a2713aSLionel Sambuc      set( value "x86_64-pc-win32" )
8*f4a2713aSLionel Sambuc    else()
9*f4a2713aSLionel Sambuc      set( value "i686-pc-win32" )
10*f4a2713aSLionel Sambuc    endif()
11*f4a2713aSLionel Sambuc  elseif( MINGW AND NOT MSYS )
12*f4a2713aSLionel Sambuc    if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
13*f4a2713aSLionel Sambuc      set( value "x86_64-w64-mingw32" )
14*f4a2713aSLionel Sambuc    else()
15*f4a2713aSLionel Sambuc      set( value "i686-pc-mingw32" )
16*f4a2713aSLionel Sambuc    endif()
17*f4a2713aSLionel Sambuc  else( MSVC )
18*f4a2713aSLionel Sambuc    set(config_guess ${LLVM_MAIN_SRC_DIR}/autoconf/config.guess)
19*f4a2713aSLionel Sambuc    execute_process(COMMAND sh ${config_guess}
20*f4a2713aSLionel Sambuc      RESULT_VARIABLE TT_RV
21*f4a2713aSLionel Sambuc      OUTPUT_VARIABLE TT_OUT
22*f4a2713aSLionel Sambuc      OUTPUT_STRIP_TRAILING_WHITESPACE)
23*f4a2713aSLionel Sambuc    if( NOT TT_RV EQUAL 0 )
24*f4a2713aSLionel Sambuc      message(FATAL_ERROR "Failed to execute ${config_guess}")
25*f4a2713aSLionel Sambuc    endif( NOT TT_RV EQUAL 0 )
26*f4a2713aSLionel Sambuc    set( value ${TT_OUT} )
27*f4a2713aSLionel Sambuc  endif( MSVC )
28*f4a2713aSLionel Sambuc  set( ${var} ${value} PARENT_SCOPE )
29*f4a2713aSLionel Sambuc  message(STATUS "Target triple: ${value}")
30*f4a2713aSLionel Sambucendfunction( get_host_triple var )
31