Skip to content

Commit fe846bc

Browse files
authored
Escape LLVM_TARGETS_TO_BUILD while checking against LLVM_ALL_TARGETS and LLVM_EXPERIMENTAL_TARGETS_TO_BUILD (#70885)
Targeting X86 while building LLVM with the Android NDK, currently fails with "The target `X86' is not a core tier target. It may be experimental, if so it must be passed via LLVM_EXPERIMENTAL_TARGETS_TO_BUILD." This is happening because the Android NDK defines a variable named X86, which will lead to a "fun" CMake feature. For further details reference [this post](https://discourse.llvm.org/t/the-target-x86-is-not-a-core-tier-target/73784). To fix this, the LLVM_TARGETS_TO_BUILD need to be escaped while checking agains LLVM_ALL_TARGETS and LLVM_EXPERIMENTAL_TARGETS_TO_BUILD.
1 parent 264f5ec commit fe846bc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -942,8 +942,8 @@ foreach(t ${LLVM_TARGETS_TO_BUILD})
942942
# LLVM_EXPERIMENTAL_TARGETS_TO_BUILD, not LLVM_TARGETS_TO_BUILD.
943943
# We allow experimental targets that are not in LLVM_ALL_EXPERIMENTAL_TARGETS,
944944
# as long as they are passed via LLVM_EXPERIMENTAL_TARGETS_TO_BUILD.
945-
if ( NOT ${t} IN_LIST LLVM_ALL_TARGETS AND NOT ${t} IN_LIST LLVM_EXPERIMENTAL_TARGETS_TO_BUILD )
946-
if( ${t} IN_LIST LLVM_ALL_EXPERIMENTAL_TARGETS )
945+
if ( NOT "${t}" IN_LIST LLVM_ALL_TARGETS AND NOT "${t}" IN_LIST LLVM_EXPERIMENTAL_TARGETS_TO_BUILD )
946+
if( "${t}" IN_LIST LLVM_ALL_EXPERIMENTAL_TARGETS )
947947
message(FATAL_ERROR "The target `${t}' is experimental and must be passed "
948948
"via LLVM_EXPERIMENTAL_TARGETS_TO_BUILD.")
949949
else()

0 commit comments

Comments
 (0)