[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / llvm / cmake / modules / GetHostTriple.cmake
blob1be13bc01ab9b255f70994938e3fb167a569d367
1 # Returns the host triple.
2 # Invokes config.guess
4 function( get_host_triple var )
5   if( MSVC )
6     if( CMAKE_C_COMPILER_ARCHITECTURE_ID MATCHES "ARM64.*" )
7       set( value "aarch64-pc-windows-msvc" )
8     elseif( CMAKE_C_COMPILER_ARCHITECTURE_ID MATCHES "ARM.*" )
9       set( value "armv7-pc-windows-msvc" )
10     elseif( CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "x64" )
11       set( value "x86_64-pc-windows-msvc" )
12     elseif( CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "X86" )
13       set( value "i686-pc-windows-msvc" )
14     elseif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
15       set( value "x86_64-pc-windows-msvc" )
16     else()
17       set( value "i686-pc-windows-msvc" )
18     endif()
19   elseif( MINGW AND NOT MSYS )
20     # CMake doesn't provide COMPILER_ARCHITECTURE_ID for Clang/GCC,
21     # but it does for MSVC.
22     if( CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "ARM.*" )
23       if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
24         set( value "aarch64-w64-windows-gnu" )
25       else()
26         set( value "armv7-w64-windows-gnu" )
27       endif()
28     else()
29       if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
30         set( value "x86_64-w64-windows-gnu" )
31       else()
32         set( value "i686-w64-windows-gnu" )
33       endif()
34     endif()
35   elseif( CMAKE_SYSTEM_NAME MATCHES "OS390" )
36     set( value "s390x-ibm-zos" )
37   elseif( CMAKE_SYSTEM_NAME STREQUAL AIX )
38     # We defer to dynamic detection of the host AIX version.
39     if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
40       set( value "powerpc64-ibm-aix" )
41     else()
42       set( value "powerpc-ibm-aix" )
43     endif()
44   else( MSVC )
45     if(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows AND NOT MSYS)
46       message(WARNING "unable to determine host target triple")
47     else()
48       set(config_guess ${LLVM_MAIN_SRC_DIR}/cmake/config.guess)
49       execute_process(COMMAND sh ${config_guess}
50         RESULT_VARIABLE TT_RV
51         OUTPUT_VARIABLE TT_OUT
52         OUTPUT_STRIP_TRAILING_WHITESPACE)
53       if( NOT TT_RV EQUAL 0 )
54         message(FATAL_ERROR "Failed to execute ${config_guess}")
55       endif( NOT TT_RV EQUAL 0 )
56       set( value ${TT_OUT} )
57     endif()
58   endif( MSVC )
59   set( ${var} ${value} PARENT_SCOPE )
60 endfunction( get_host_triple var )