Undo an over zealous rename. This bit of the CMake build really is
authorChandler Carruth <chandlerc@gmail.com>
Tue, 24 Jan 2012 18:00:44 +0000 (18:00 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Tue, 24 Jan 2012 18:00:44 +0000 (18:00 +0000)
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

cmake/config-ix.cmake
cmake/modules/CMakeLists.txt
cmake/modules/GetHostTriple.cmake [new file with mode: 0644]
cmake/modules/GetTargetTriple.cmake [deleted file]

index b380a48637fd143139f93d6b4c6aa74ae19064c5..f6eeea9ee607a2fd7c5e89535cb0027b1bb23a95 100755 (executable)
@@ -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")
index 88d985208c7298722776f92e16be23f4d6b7a5c8..f51e9af8db0db2b77a19fa8ab65b7537e49a0d1a 100644 (file)
@@ -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 (file)
index 0000000..671a8ce
--- /dev/null
@@ -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 (file)
index f4321c9..0000000
+++ /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 )