2008-10-26 08:47:52 +08:00
|
|
|
# Returns the host triple.
|
|
|
|
# Invokes config.guess
|
|
|
|
|
2012-01-25 02:00:44 +08:00
|
|
|
function( get_host_triple var )
|
2008-10-26 08:47:52 +08:00
|
|
|
if( MSVC )
|
2017-12-14 05:11:14 +08:00
|
|
|
if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
2018-08-09 10:16:18 +08:00
|
|
|
set( value "x86_64-pc-windows-msvc" )
|
2009-08-12 08:04:12 +08:00
|
|
|
else()
|
2018-08-09 10:16:18 +08:00
|
|
|
set( value "i686-pc-windows-msvc" )
|
2009-08-12 08:04:12 +08:00
|
|
|
endif()
|
2009-08-17 04:50:41 +08:00
|
|
|
elseif( MINGW AND NOT MSYS )
|
2010-10-14 04:15:08 +08:00
|
|
|
if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
2018-08-09 10:16:18 +08:00
|
|
|
set( value "x86_64-w64-windows-gnu" )
|
2010-10-14 04:15:08 +08:00
|
|
|
else()
|
2018-08-09 10:16:18 +08:00
|
|
|
set( value "i686-pc-windows-gnu" )
|
2010-10-14 04:15:08 +08:00
|
|
|
endif()
|
2020-02-21 04:39:16 +08:00
|
|
|
elseif( CMAKE_HOST_SYSTEM_NAME STREQUAL AIX )
|
|
|
|
# We defer to dynamic detection of the host AIX version.
|
|
|
|
if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
|
|
|
set( value "powerpc64-ibm-aix" )
|
|
|
|
else()
|
|
|
|
set( value "powerpc-ibm-aix" )
|
|
|
|
endif()
|
2008-10-26 08:47:52 +08:00
|
|
|
else( MSVC )
|
2019-06-27 06:07:43 +08:00
|
|
|
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows AND NOT MSYS)
|
2019-06-15 00:47:04 +08:00
|
|
|
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 )
|
2020-02-21 04:39:16 +08:00
|
|
|
set( value ${TT_OUT} )
|
2019-06-15 00:47:04 +08:00
|
|
|
endif()
|
2008-10-26 08:47:52 +08:00
|
|
|
endif( MSVC )
|
2009-11-08 07:52:27 +08:00
|
|
|
set( ${var} ${value} PARENT_SCOPE )
|
2012-01-25 02:00:44 +08:00
|
|
|
endfunction( get_host_triple var )
|