]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - opencl/llvm.git/blob - cmake/modules/GetTargetTriple.cmake
CMake: GetTargetTriple: new module for determining the target
[opencl/llvm.git] / cmake / modules / GetTargetTriple.cmake
1 # Returns the host triple.
2 # Invokes config.guess
4 function( get_target_triple var )
5   if( MSVC )
6     set( ${var} "i686-pc-win32" PARENT_SCOPE )
7   else( MSVC )
8     set(config_guess ${LLVM_MAIN_SRC_DIR}/autoconf/config.guess)
9     execute_process(COMMAND sh ${config_guess}
10       RESULT_VARIABLE TT_RV
11       OUTPUT_VARIABLE TT_OUT
12       OUTPUT_STRIP_TRAILING_WHITESPACE)
13     if( NOT TT_RV EQUAL 0 )
14       message(FATAL_ERROR "Failed to execute ${config_guess}")
15     endif( NOT TT_RV EQUAL 0 )
16     set( ${var} ${TT_OUT} PARENT_SCOPE )
17     message(STATUS "Target triple: ${${var}}")
18   endif( MSVC )
19 endfunction( get_target_triple var )