Fix cmake build without native target selected.

The cmake (+ MSVC) build is broken if you don't select your native
target.

e.g. 'cmake -D LLVM_TARGETS_TO_BUILD="MyNonNativeTarget" .'

This is because cmake currently sets the LLVM_NATIVE_* definitions
regardless of whether the native target is selected (causing build
errors).

Patch by Mike Gist!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112946 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Oscar Fuentes 2010-09-03 02:22:23 +00:00
parent 95f1e2d6b5
commit e1967a742e

View File

@ -207,9 +207,6 @@ else ()
endif ()
if (LLVM_NATIVE_ARCH)
set(LLVM_NATIVE_TARGET LLVMInitialize${LLVM_NATIVE_ARCH}Target)
set(LLVM_NATIVE_TARGETINFO LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo)
set(LLVM_NATIVE_ASMPRINTER LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter)
list(FIND LLVM_TARGETS_TO_BUILD ${LLVM_NATIVE_ARCH} NATIVE_ARCH_IDX)
if (NATIVE_ARCH_IDX EQUAL -1)
message(STATUS
@ -217,6 +214,9 @@ if (LLVM_NATIVE_ARCH)
set(LLVM_NATIVE_ARCH)
else ()
message(STATUS "Native target architecture is ${LLVM_NATIVE_ARCH}")
set(LLVM_NATIVE_TARGET LLVMInitialize${LLVM_NATIVE_ARCH}Target)
set(LLVM_NATIVE_TARGETINFO LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo)
set(LLVM_NATIVE_ASMPRINTER LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter)
endif ()
endif()