From: Oscar Fuentes Date: Fri, 3 Sep 2010 02:22:23 +0000 (+0000) Subject: Fix cmake build without native target selected. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e1967a742e1fcbb5fb525f87b8501e8f6e3ef878;p=oota-llvm.git 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 --- diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index 56e8d837366..f75e5dfb265 100755 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -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()