From: Chandler Carruth Date: Tue, 24 Jan 2012 18:00:44 +0000 (+0000) Subject: Undo an over zealous rename. This bit of the CMake build really is X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=9136f2112ca67bf360ee64b6546abea9dce0579c;p=oota-llvm.git Undo an over zealous rename. This bit of the CMake build really is dealing in the host triple, be honest about it and document the decision to default the target triple to the host triple unless overridden. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148822 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index b380a48637f..f6eeea9ee60 100755 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -287,15 +287,18 @@ include(CheckCXXCompilerFlag) check_cxx_compiler_flag("-Wno-variadic-macros" SUPPORTS_NO_VARIADIC_MACROS_FLAG) -include(GetTargetTriple) -get_target_triple(LLVM_DEFAULT_TARGET_TRIPLE) +include(GetHostTriple) +get_host_triple(LLVM_HOST_TRIPLE) +# By default, we target the host, but this can be overridden at CMake +# invocation time. +set(LLVM_DEFAULT_TARGET_TRIPLE "${LLVM_HOST_TRIPLE}") set(TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}") # Determine the native architecture. string(TOLOWER "${LLVM_TARGET_ARCH}" LLVM_NATIVE_ARCH) if( LLVM_NATIVE_ARCH STREQUAL "host" ) - string(REGEX MATCH "^[^-]*" LLVM_NATIVE_ARCH ${LLVM_DEFAULT_TARGET_TRIPLE}) + string(REGEX MATCH "^[^-]*" LLVM_NATIVE_ARCH ${LLVM_HOST_TRIPLE}) endif () if (LLVM_NATIVE_ARCH MATCHES "i[2-6]86") diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt index 88d985208c7..f51e9af8db0 100644 --- a/cmake/modules/CMakeLists.txt +++ b/cmake/modules/CMakeLists.txt @@ -32,6 +32,6 @@ install(DIRECTORY . PATTERN LLVMConfig.cmake EXCLUDE PATTERN LLVMConfigVersion.cmake EXCLUDE PATTERN LLVM-Config.cmake EXCLUDE - PATTERN GetTargetTriple.cmake EXCLUDE + PATTERN GetHostTriple.cmake EXCLUDE PATTERN VersionFromVCS.cmake EXCLUDE PATTERN CheckAtomic.cmake EXCLUDE) diff --git a/cmake/modules/GetHostTriple.cmake b/cmake/modules/GetHostTriple.cmake new file mode 100644 index 00000000000..671a8ce7d7c --- /dev/null +++ b/cmake/modules/GetHostTriple.cmake @@ -0,0 +1,30 @@ +# Returns the host triple. +# Invokes config.guess + +function( get_host_triple var ) + if( MSVC ) + if( CMAKE_CL_64 ) + set( value "x86_64-pc-win32" ) + else() + set( value "i686-pc-win32" ) + endif() + elseif( MINGW AND NOT MSYS ) + if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) + set( value "x86_64-w64-mingw32" ) + else() + set( value "i686-pc-mingw32" ) + endif() + else( MSVC ) + set(config_guess ${LLVM_MAIN_SRC_DIR}/autoconf/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 ) + set( value ${TT_OUT} ) + endif( MSVC ) + set( ${var} ${value} PARENT_SCOPE ) + message(STATUS "Target triple: ${value}") +endfunction( get_host_triple var ) diff --git a/cmake/modules/GetTargetTriple.cmake b/cmake/modules/GetTargetTriple.cmake deleted file mode 100644 index f4321c9b67e..00000000000 --- a/cmake/modules/GetTargetTriple.cmake +++ /dev/null @@ -1,30 +0,0 @@ -# Returns the host triple. -# Invokes config.guess - -function( get_target_triple var ) - if( MSVC ) - if( CMAKE_CL_64 ) - set( value "x86_64-pc-win32" ) - else() - set( value "i686-pc-win32" ) - endif() - elseif( MINGW AND NOT MSYS ) - if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) - set( value "x86_64-w64-mingw32" ) - else() - set( value "i686-pc-mingw32" ) - endif() - else( MSVC ) - set(config_guess ${LLVM_MAIN_SRC_DIR}/autoconf/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 ) - set( value ${TT_OUT} ) - endif( MSVC ) - set( ${var} ${value} PARENT_SCOPE ) - message(STATUS "Target triple: ${value}") -endfunction( get_target_triple var )