authorgravatar for 124872+jedisct1@users.noreply.github.comFrank Denis <124872+jedisct1@users.noreply.github.com> 2020-09-26 17:10:33+02:00
committergravatar for 124872+jedisct1@users.noreply.github.comFrank Denis <124872+jedisct1@users.noreply.github.com> 2020-09-26 17:10:33+02:00
log99c5d2d59053f647c041f71d75ee50f51a610977
treed408074a9093b825b3d9681381537262f2531876
parenta502604702726f3983f8a8b80bb73d9d5381baab

Print the llvm-config path on configuration error

This is helpful on systems with multiple LLVM installations. For example, OpenBSD ships with LLVM in the base system, but without support for extra targets. A full LLVM version can be installed using the ports system, but even when it is, `cmake` is not going to pick it up unless `/usr/local` is explicitly added to the `cmake` search paths. Having the full `llvm-config` path printed on error is helpful to understand that the detected LLVM version was not the expected one.

1 files changed, 4 insertions(+), 4 deletions(-)

cmake/Findllvm.cmake+4-4
......@@ -55,13 +55,13 @@ elseif("${ZIG_TARGET_TRIPLE}" STREQUAL "native")
5555 OUTPUT_STRIP_TRAILING_WHITESPACE)
5656
5757 if("${LLVM_CONFIG_VERSION}" VERSION_LESS 10)
58 message(FATAL_ERROR "expected LLVM 10.x but found ${LLVM_CONFIG_VERSION}")
58 message(FATAL_ERROR "expected LLVM 10.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
5959 endif()
6060 if("${LLVM_CONFIG_VERSION}" VERSION_EQUAL 11)
61 message(FATAL_ERROR "expected LLVM 10.x but found ${LLVM_CONFIG_VERSION}")
61 message(FATAL_ERROR "expected LLVM 10.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
6262 endif()
6363 if("${LLVM_CONFIG_VERSION}" VERSION_GREATER 11)
64 message(FATAL_ERROR "expected LLVM 10.x but found ${LLVM_CONFIG_VERSION}")
64 message(FATAL_ERROR "expected LLVM 10.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
6565 endif()
6666
6767 execute_process(
......@@ -72,7 +72,7 @@ elseif("${ZIG_TARGET_TRIPLE}" STREQUAL "native")
7272 function(NEED_TARGET TARGET_NAME)
7373 list (FIND LLVM_TARGETS_BUILT "${TARGET_NAME}" _index)
7474 if (${_index} EQUAL -1)
75 message(FATAL_ERROR "LLVM is missing target ${TARGET_NAME}. Zig requires LLVM to be built with all default targets enabled.")
75 message(FATAL_ERROR "LLVM (according to ${LLVM_CONFIG_EXE}) is missing target ${TARGET_NAME}. Zig requires LLVM to be built with all default targets enabled.")
7676 endif()
7777 endfunction(NEED_TARGET)
7878 NEED_TARGET("AArch64")