build: link against system libs reported by llvm-config

This commit is contained in:
Andrew Kelley 2017-06-19 10:33:19 -04:00
parent 76344a6fc4
commit 62b23f5da5
2 changed files with 8 additions and 3 deletions

1
.gitignore vendored
View File

@ -3,6 +3,7 @@ build/
build-release/
build-windows/
build-llvm-5/
build-llvm-debug/
/.cproject
/.project
/.settings/

View File

@ -20,6 +20,11 @@ execute_process(
OUTPUT_VARIABLE LLVM_LIBRARIES
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND ${LLVM_CONFIG_EXE} --system-libs
OUTPUT_VARIABLE LLVM_SYSTEM_LIBS
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND ${LLVM_CONFIG_EXE} --libdir
OUTPUT_VARIABLE LLVM_LIBDIRS
@ -32,14 +37,13 @@ execute_process(
find_library(LLVM_LIBRARY NAMES LLVM)
set(LLVM_LIBRARIES ${LLVM_LIBRARIES} ${LLVM_SYSTEM_LIBS})
if(LLVM_LIBRARY)
set(LLVM_LIBRARIES ${LLVM_LIBRARY})
endif()
set(LLVM_LIBRARIES ${LLVM_LIBRARIES} ${LLVM_SYSTEM_LIBS})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LLVM DEFAULT_MSG LLVM_LIBRARIES LLVM_INCLUDE_DIR)