diff --git a/core/clingutils/CMakeLists.txt b/core/clingutils/CMakeLists.txt index ec4024f1d9b14..f63e4cea944cf 100644 --- a/core/clingutils/CMakeLists.txt +++ b/core/clingutils/CMakeLists.txt @@ -85,7 +85,13 @@ if (builtin_clang) set(CLANG_RESOURCE_DIR_STEM ${CMAKE_BINARY_DIR}/interpreter/llvm-project/llvm/${CMAKE_CFG_INTDIR}/lib/clang) set(CLANG_RESOURCE_DIR_VERSION ${LLVM_VERSION_MAJOR}) else () - set(CLANG_RESOURCE_DIR_STEM ${LLVM_LIBRARY_DIR}/clang) + # If Clang was installed standalone (in particular, not in the LLVM tree), + # use the CLANG_INSTALL_PREFIX variable to indicate where it is. + if(DEFINED CLANG_INSTALL_PREFIX) + set(CLANG_RESOURCE_DIR_STEM ${CLANG_INSTALL_PREFIX}/lib/clang) + else() + set(CLANG_RESOURCE_DIR_STEM ${LLVM_LIBRARY_DIR}/clang) + endif() # A user can define a clang version to use, otherwise find it (but will error if more than one version is present) if (NOT DEFINED CLANG_RESOURCE_DIR_VERSION) if (NOT EXISTS ${CLANG_RESOURCE_DIR_STEM})