1 # Returns the host triple. 2 # Invokes config.guess 3 4 function( get_host_triple var ) 5 if( MSVC ) 6 if( CMAKE_CL_64 ) 7 set( value "x86_64-pc-win32" ) 8 else() 9 set( value "i686-pc-win32" ) 10 endif() 11 elseif( MINGW AND NOT MSYS ) 12 if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) 13 set( value "x86_64-w64-mingw32" ) 14 else() 15 set( value "i686-pc-mingw32" ) 16 endif() 17 else( MSVC ) 18 set(config_guess ${LLVM_MAIN_SRC_DIR}/autoconf/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 message(STATUS "Target triple: ${value}") 30 endfunction( get_host_triple var ) 31