Skip to content

Commit 79840fe

Browse files
committed
[CMake] Support standalone builds of Clang
If Clang was installed standalone (in particular, not in the LLVM tree), use the CLANG_INSTALL_PREFIX variable to indicate where it is. This is the same as 02b0dc1, but only changing the behavior when `CLANG_INSTALL_PREFIX` is set without any other changes. This should be a much less risky change (see also the revert in 6179736).
1 parent 12c8aff commit 79840fe

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

core/clingutils/CMakeLists.txt

+7-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,13 @@ if (builtin_clang)
8585
set(CLANG_RESOURCE_DIR_STEM ${CMAKE_BINARY_DIR}/interpreter/llvm-project/llvm/${CMAKE_CFG_INTDIR}/lib/clang)
8686
set(CLANG_RESOURCE_DIR_VERSION ${LLVM_VERSION_MAJOR})
8787
else ()
88-
set(CLANG_RESOURCE_DIR_STEM ${LLVM_LIBRARY_DIR}/clang)
88+
# If Clang was installed standalone (in particular, not in the LLVM tree),
89+
# use the CLANG_INSTALL_PREFIX variable to indicate where it is.
90+
if(DEFINED CLANG_INSTALL_PREFIX)
91+
set(CLANG_RESOURCE_DIR_STEM ${CLANG_INSTALL_PREFIX}/lib/clang)
92+
else()
93+
set(CLANG_RESOURCE_DIR_STEM ${LLVM_LIBRARY_DIR}/clang)
94+
endif()
8995
# A user can define a clang version to use, otherwise find it (but will error if more than one version is present)
9096
if (NOT DEFINED CLANG_RESOURCE_DIR_VERSION)
9197
if (NOT EXISTS ${CLANG_RESOURCE_DIR_STEM})

0 commit comments

Comments
 (0)