Skip to content

Commit 6257b47

Browse files
mstorsjotkrasnukha
authored andcommitted
Fix rerunning cmake with statically linked llvm
Previously, the llvm_lib variable was cached from one run to the next, making the condition for looking for deps for a statically linked llvm evaluate differently on the second run. Use separate variables for the find_library results, so they behave correctly when using cached results.
1 parent 9f6b5bf commit 6257b47

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,14 @@ else()
8585
find_library(lib_lldb NAMES lldb liblldb HINTS ${LLVM_LIBRARY_DIRS})
8686
endif()
8787

88-
find_library(lib_llvm LLVM HINTS ${LLVM_LIBRARY_DIRS})
88+
find_library(lib_llvm_shared LLVM HINTS ${LLVM_LIBRARY_DIRS})
8989

90-
if (NOT lib_llvm)
90+
if (lib_llvm_shared)
91+
set(lib_llvm "${lib_llvm_shared}")
92+
else()
9193
message(STATUS "Can't find LLVM shared library, falling back to static linking LLVMSupport")
92-
find_library(lib_llvm LLVMSupport HINTS ${LLVM_LIBRARY_DIRS})
94+
find_library(lib_llvm_static LLVMSupport HINTS ${LLVM_LIBRARY_DIRS})
95+
set(lib_llvm "${lib_llvm_static}")
9396

9497
get_property(LLVMSupportDeps GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_LLVMSupport)
9598
foreach(dependency ${LLVMSupportDeps})

0 commit comments

Comments
 (0)