2008-10-26 02:47:52 +02:00
|
|
|
# Returns the host triple.
|
|
|
|
# Invokes config.guess
|
|
|
|
|
2012-01-24 19:00:44 +01:00
|
|
|
function( get_host_triple var )
|
2008-10-26 02:47:52 +02:00
|
|
|
if( MSVC )
|
2017-12-13 22:11:14 +01:00
|
|
|
if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
2018-08-09 04:16:18 +02:00
|
|
|
set( value "x86_64-pc-windows-msvc" )
|
2009-08-12 02:04:12 +02:00
|
|
|
else()
|
2018-08-09 04:16:18 +02:00
|
|
|
set( value "i686-pc-windows-msvc" )
|
2009-08-12 02:04:12 +02:00
|
|
|
endif()
|
2009-08-16 22:50:41 +02:00
|
|
|
elseif( MINGW AND NOT MSYS )
|
2010-10-13 22:15:08 +02:00
|
|
|
if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
2018-08-09 04:16:18 +02:00
|
|
|
set( value "x86_64-w64-windows-gnu" )
|
2010-10-13 22:15:08 +02:00
|
|
|
else()
|
2018-08-09 04:16:18 +02:00
|
|
|
set( value "i686-pc-windows-gnu" )
|
2010-10-13 22:15:08 +02:00
|
|
|
endif()
|
2020-07-09 14:17:33 +02:00
|
|
|
elseif( CMAKE_SYSTEM_NAME MATCHES "OS390" )
|
|
|
|
set( value "s390x-ibm-zos" )
|
|
|
|
elseif( CMAKE_SYSTEM_NAME STREQUAL AIX )
|
2020-02-20 21:39:16 +01:00
|
|
|
# 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 02:47:52 +02:00
|
|
|
else( MSVC )
|
2019-06-27 00:07:43 +02:00
|
|
|
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows AND NOT MSYS)
|
2019-06-14 18:47:04 +02: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-20 21:39:16 +01:00
|
|
|
set( value ${TT_OUT} )
|
2019-06-14 18:47:04 +02:00
|
|
|
endif()
|
2008-10-26 02:47:52 +02:00
|
|
|
endif( MSVC )
|
2009-11-08 00:52:27 +01:00
|
|
|
set( ${var} ${value} PARENT_SCOPE )
|
2012-01-24 19:00:44 +01:00
|
|
|
endfunction( get_host_triple var )
|