Skip to content

Commit 6f679b9

Browse files
committed
CMake: Fix extraction of TableGen lib from LLVM libs
The previous regex only happened to work because the TableGen lib apparently used to be the first one. The new WindowsManifest lib is the new first lib for LLVM 6.0. The previous regex also didn't work on Windows/MSVC as the LLVM_LIBRARIES entry doesn't start with `-`; it looks like `C:\...\LLVMTableGen.lib`.
1 parent 588a523 commit 6f679b9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ find_package(LLVM 3.7 REQUIRED
2828
windowsmanifest ${EXTRA_LLVM_MODULES})
2929
math(EXPR LDC_LLVM_VER ${LLVM_VERSION_MAJOR}*100+${LLVM_VERSION_MINOR})
3030
# Remove LLVMTableGen library from list of libraries
31-
string(REGEX MATCH "^-.*LLVMTableGen[^;]*;|;-.*LLVMTableGen[^;]*" LLVM_TABLEGEN_LIBRARY "${LLVM_LIBRARIES}")
32-
string(REGEX REPLACE "^-.*LLVMTableGen[^;]*;|;-.*LLVMTableGen[^;]*" "" LLVM_LIBRARIES "${LLVM_LIBRARIES}")
31+
message(STATUS "${LLVM_LIBRARIES}")
32+
string(REGEX MATCH "[^;]*LLVMTableGen[^;]*" LLVM_TABLEGEN_LIBRARY "${LLVM_LIBRARIES}")
33+
message(STATUS "${LLVM_TABLEGEN_LIBRARY}")
34+
string(REGEX REPLACE "[^;]*LLVMTableGen[^;]*;?" "" LLVM_LIBRARIES "${LLVM_LIBRARIES}")
35+
message(STATUS "${LLVM_LIBRARIES}")
3336

3437
# Information about which targets LLVM was built to target
3538
foreach(LLVM_SUPPORTED_TARGET ${LLVM_TARGETS_TO_BUILD})

0 commit comments

Comments
 (0)