aboutsummaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorOscar Fuentes <ofv@wanadoo.es>2009-09-13 22:18:38 +0000
committerOscar Fuentes <ofv@wanadoo.es>2009-09-13 22:18:38 +0000
commita9ff1392ea5d21b2dd9fbe37a0f268b2834211d0 (patch)
tree92c96d1e53d8fe9556bd93072415ac604e6354ea /cmake
parent422094c38dfe6878de40f4ad443dcd77542fac22 (diff)
downloadexternal_llvm-a9ff1392ea5d21b2dd9fbe37a0f268b2834211d0.zip
external_llvm-a9ff1392ea5d21b2dd9fbe37a0f268b2834211d0.tar.gz
external_llvm-a9ff1392ea5d21b2dd9fbe37a0f268b2834211d0.tar.bz2
CMake: New user-settable variable LLVM_TARGET_ARCH useful when
cross-compiling. Patch by Xerxes RĂ„nby! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81722 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rwxr-xr-xcmake/config-ix.cmake13
1 files changed, 9 insertions, 4 deletions
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
index 85f9470..5b63778 100755
--- a/cmake/config-ix.cmake
+++ b/cmake/config-ix.cmake
@@ -92,13 +92,18 @@ get_target_triple(LLVM_HOSTTRIPLE)
message(STATUS "LLVM_HOSTTRIPLE: ${LLVM_HOSTTRIPLE}")
# Determine the native architecture.
-# FIXME: this will have to change for cross-compiling.
-string(REGEX MATCH "^[^-]*" LLVM_NATIVE_ARCH ${LLVM_HOSTTRIPLE})
+string(TOLOWER "${LLVM_TARGET_ARCH}" LLVM_NATIVE_ARCH)
+if( LLVM_NATIVE_ARCH STREQUAL "host" )
+ string(REGEX MATCH "^[^-]*" LLVM_NATIVE_ARCH ${LLVM_HOSTTRIPLE})
+endif ()
+
if (LLVM_NATIVE_ARCH MATCHES "i[2-6]86")
set(LLVM_NATIVE_ARCH X86)
-elseif (LLVM_NATIVE_ARCH STREQUAL amd64)
+elseif (LLVM_NATIVE_ARCH STREQUAL "x86")
+ set(LLVM_NATIVE_ARCH X86)
+elseif (LLVM_NATIVE_ARCH STREQUAL "amd64")
set(LLVM_NATIVE_ARCH X86)
-elseif (LLVM_NATIVE_ARCH STREQUAL x86_64)
+elseif (LLVM_NATIVE_ARCH STREQUAL "x86_64")
set(LLVM_NATIVE_ARCH X86)
elseif (LLVM_NATIVE_ARCH MATCHES "sparc")
set(LLVM_NATIVE_ARCH Sparc)