2015-08-05 23:23:15 +01:00
|
|
|
# Copyright (c) 2014 Andrew Kelley
|
|
|
|
# This file is MIT licensed.
|
|
|
|
# See http://opensource.org/licenses/MIT
|
|
|
|
|
|
|
|
# LLVM_FOUND
|
2015-11-25 18:23:25 +00:00
|
|
|
# LLVM_INCLUDE_DIRS
|
2015-08-05 23:23:15 +01:00
|
|
|
# LLVM_LIBRARIES
|
2015-11-25 18:23:25 +00:00
|
|
|
# LLVM_LIBDIRS
|
2015-08-05 23:23:15 +01:00
|
|
|
|
2015-11-25 18:23:25 +00:00
|
|
|
find_path(LLVM_C_INCLUDE_DIR NAMES llvm-c/Core.h PATHS /usr/include/llvm-c-3.7/)
|
|
|
|
find_path(LLVM_INCLUDE_DIR NAMES llvm/IR/IRBuilder.h PATHS /usr/include/llvm-3.7/)
|
2015-11-25 18:37:43 +00:00
|
|
|
set(LLVM_INCLUDE_DIRS ${LLVM_C_INCLUDE_DIR} ${LLVM_INCLUDE_DIR})
|
2016-01-20 05:07:19 +00:00
|
|
|
|
|
|
|
find_library(LLVM_LIBRARY NAMES LLVM)
|
|
|
|
if(LLVM_LIBRARY)
|
|
|
|
set(LLVM_LIBRARIES ${LLVM_LIBRARY})
|
|
|
|
set(LLVM_LIBDIRS "")
|
|
|
|
else()
|
|
|
|
find_program(LLVM_CONFIG_EXE NAMES llvm-config llvm-config-3.7)
|
|
|
|
|
|
|
|
execute_process(
|
|
|
|
COMMAND ${LLVM_CONFIG_EXE} --libs
|
|
|
|
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
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
|
|
|
|
set(LLVM_LIBRARIES ${LLVM_LIBRARIES} ${LLVM_SYSTEM_LIBS})
|
|
|
|
endif()
|
2015-11-25 18:23:25 +00:00
|
|
|
|
|
|
|
|
2015-08-05 23:23:15 +01:00
|
|
|
include(FindPackageHandleStandardArgs)
|
2015-11-25 18:23:25 +00:00
|
|
|
find_package_handle_standard_args(LLVM DEFAULT_MSG LLVM_LIBRARIES LLVM_INCLUDE_DIRS)
|
2015-08-05 23:23:15 +01:00
|
|
|
|
2015-11-25 18:23:25 +00:00
|
|
|
mark_as_advanced(LLVM_INCLUDE_DIRS LLVM_LIBRARIES LLVM_LIBDIRS)
|