Skip to content

Commit fe2bd9d

Browse files
BratishkaErikandrewrk
authored andcommitted
cmake: move 'continue' statement to avoid cmake bug
1 parent e0fb4c2 commit fe2bd9d

1 file changed

Lines changed: 11 additions & 21 deletions

File tree

cmake/Findllvm.cmake

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -79,35 +79,25 @@ if(ZIG_USE_LLVM_CONFIG)
7979
OUTPUT_VARIABLE LLVM_TARGETS_BUILT_SPACES
8080
OUTPUT_STRIP_TRAILING_WHITESPACE)
8181
string(REPLACE " " ";" LLVM_TARGETS_BUILT "${LLVM_TARGETS_BUILT_SPACES}")
82-
function(NEED_TARGET TARGET_NAME)
82+
83+
set(ZIG_LLVM_REQUIRED_TARGETS "AArch64;AMDGPU;ARM;AVR;BPF;Hexagon;Lanai;Mips;MSP430;NVPTX;PowerPC;RISCV;Sparc;SystemZ;VE;WebAssembly;X86;XCore")
84+
85+
set(ZIG_LLVM_REQUIRED_TARGETS_ENABLED TRUE)
86+
foreach(TARGET_NAME IN LISTS ZIG_LLVM_REQUIRED_TARGETS)
8387
list (FIND LLVM_TARGETS_BUILT "${TARGET_NAME}" _index)
8488
if (${_index} EQUAL -1)
8589
# Save the error message, in case this is the last llvm-config we find
8690
list(APPEND LLVM_CONFIG_ERROR_MESSAGES "LLVM (according to ${LLVM_CONFIG_EXE}) is missing target ${TARGET_NAME}. Zig requires LLVM to be built with all default targets enabled.")
8791

8892
# Ignore this directory and try the search again
8993
list(APPEND CMAKE_IGNORE_PATH "${LLVM_CONFIG_DIR}")
90-
continue()
94+
set(ZIG_LLVM_REQUIRED_TARGETS_ENABLED FALSE)
95+
break()
9196
endif()
92-
endfunction(NEED_TARGET)
93-
NEED_TARGET("AArch64")
94-
NEED_TARGET("AMDGPU")
95-
NEED_TARGET("ARM")
96-
NEED_TARGET("AVR")
97-
NEED_TARGET("BPF")
98-
NEED_TARGET("Hexagon")
99-
NEED_TARGET("Lanai")
100-
NEED_TARGET("Mips")
101-
NEED_TARGET("MSP430")
102-
NEED_TARGET("NVPTX")
103-
NEED_TARGET("PowerPC")
104-
NEED_TARGET("RISCV")
105-
NEED_TARGET("Sparc")
106-
NEED_TARGET("SystemZ")
107-
NEED_TARGET("VE")
108-
NEED_TARGET("WebAssembly")
109-
NEED_TARGET("X86")
110-
NEED_TARGET("XCore")
97+
endforeach()
98+
if (NOT ZIG_LLVM_REQUIRED_TARGETS_ENABLED)
99+
continue()
100+
endif()
111101

112102
# Got it!
113103
break()

0 commit comments

Comments
 (0)