Merge pull request #2816 from comex/huh-where-did-this-go

Make the LLVM detect script verify that the dynamic library actually exists.
This commit is contained in:
comex 2015-08-09 02:55:36 -04:00
commit f135e54ba0
1 changed files with 9 additions and 3 deletions

View File

@ -1,6 +1,9 @@
# This file only exists because LLVM's cmake files are broken. # This file only exists because LLVM's cmake files are broken.
# This affects both LLVM 3.4 and 3.5. # This affects both LLVM 3.4 and 3.5.
# Hopefully when they fix their cmake system we don't need this garbage. # Hopefully when they fix their cmake system we don't need this garbage.
include(CheckLibraryExists)
list(APPEND LLVM_CONFIG_EXECUTABLES "llvm-config") list(APPEND LLVM_CONFIG_EXECUTABLES "llvm-config")
list(APPEND LLVM_CONFIG_EXECUTABLES "llvm-config-3.5") list(APPEND LLVM_CONFIG_EXECUTABLES "llvm-config-3.5")
list(APPEND LLVM_CONFIG_EXECUTABLES "llvm-config-3.4") list(APPEND LLVM_CONFIG_EXECUTABLES "llvm-config-3.4")
@ -11,13 +14,16 @@ foreach(LLVM_CONFIG_NAME ${LLVM_CONFIG_EXECUTABLES})
execute_process(COMMAND ${LLVM_CONFIG_EXE} --version OUTPUT_VARIABLE LLVM_PACKAGE_VERSION execute_process(COMMAND ${LLVM_CONFIG_EXE} --version OUTPUT_VARIABLE LLVM_PACKAGE_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE ) OUTPUT_STRIP_TRAILING_WHITESPACE )
if (${LLVM_PACKAGE_VERSION} VERSION_GREATER "3.3") if (${LLVM_PACKAGE_VERSION} VERSION_GREATER "3.3")
set(LLVM_FOUND 1)
execute_process(COMMAND ${LLVM_CONFIG_EXE} --includedir OUTPUT_VARIABLE LLVM_INCLUDE_DIRS execute_process(COMMAND ${LLVM_CONFIG_EXE} --includedir OUTPUT_VARIABLE LLVM_INCLUDE_DIRS
OUTPUT_STRIP_TRAILING_WHITESPACE ) OUTPUT_STRIP_TRAILING_WHITESPACE )
execute_process(COMMAND ${LLVM_CONFIG_EXE} --ldflags OUTPUT_VARIABLE LLVM_LDFLAGS execute_process(COMMAND ${LLVM_CONFIG_EXE} --ldflags OUTPUT_VARIABLE LLVM_LDFLAGS
OUTPUT_STRIP_TRAILING_WHITESPACE ) OUTPUT_STRIP_TRAILING_WHITESPACE )
set(LLVM_LIBRARIES "${LLVM_LDFLAGS} -lLLVM-${LLVM_PACKAGE_VERSION}") check_library_exists(LLVM-${LLVM_PACKAGE_VERSION} LLVMVerifyFunction "${LLVM_LDFLAGS}" HAVE_DYNAMIC_LLVM_${LLVM_PACKAGE_VERSION})
break() if (HAVE_DYNAMIC_LLVM_${LLVM_PACKAGE_VERSION})
set(LLVM_LIBRARIES "${LLVM_LDFLAGS} -lLLVM-${LLVM_PACKAGE_VERSION}")
set(LLVM_FOUND 1)
break()
endif()
endif() endif()
endif() endif()
endforeach() endforeach()