Skip to content

Commit 8304021

Browse files
authored
Use find_program to find llvm-config (intel#500)
llvm-config may have a different name in the default path, see intel#497. On Ubuntu 22.04, * https://apt.llvm.org/llvm.sh installs llvm-config-{VERSION} to /usr/bin folder. It is a symlink to /usr/lib/llvm-{VERSION}/bin/llvm-config. * If latest llvm is built from source, the name is /usr/local/bin/llvm-config.
1 parent 5f9111e commit 8304021

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,14 @@ endif()
267267
if(USE_PREBUILT_LLVM AND UNIX)
268268
# llvm_map_components_to_libnames(... all) returns empty string if llvm is
269269
# pre-built locally in either static or shared type in Ubuntu 22.04 container.
270-
execute_process(COMMAND llvm-config --libs all OUTPUT_VARIABLE ALL_LIBS)
270+
find_program(LLVM_CONFIG_EXE
271+
NAMES llvm-config-${PREFERRED_LLVM_VERSION} llvm-config
272+
PATHS ${LLVM_BINARY_DIR} ${LLVM_BINARY_DIR}/bin)
273+
if(NOT LLVM_CONFIG_EXE)
274+
message(FATAL_ERROR "[OPENCL-CLANG] llvm-config is not found")
275+
endif()
276+
277+
execute_process(COMMAND ${LLVM_CONFIG_EXE} --libs all OUTPUT_VARIABLE ALL_LIBS)
271278
string(REGEX REPLACE "( |\r|\n|-l)+" ";" ALL_LLVM_LIBS ${ALL_LIBS})
272279
set(ALL_LLVM_LIBS "LLVMSPIRVLib${ALL_LLVM_LIBS}")
273280
else()

0 commit comments

Comments
 (0)