# Find the native LLVM includes and library # # LLVM_INCLUDE_DIR - where to find llvm include files # LLVM_LIBRARY_DIR - where to find llvm libs # LLVM_CFLAGS - llvm compiler flags # LLVM_LFLAGS - llvm linker flags # LLVM_MODULE_LIBS - list of llvm libs for working with modules. set(LLVM_VERSION "3.4") find_program(LLVM_CONFIG_EXECUTABLE NAMES llvm-config-${LLVM_VERSION} DOC "llvm-config executable") if (LLVM_CONFIG_EXECUTABLE) message(STATUS "LLVM llvm-config-${LLVM_VERSION} found at: ${LLVM_CONFIG_EXECUTABLE}") else (LLVM_CONFIG_EXECUTABLE) message(FATAL_ERROR "Could NOT find LLVM executable. Version ${LLVM_VERSION} expected.") endif (LLVM_CONFIG_EXECUTABLE) execute_process( COMMAND ${LLVM_CONFIG_EXECUTABLE} --includedir OUTPUT_VARIABLE LLVM_INCLUDE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE ) execute_process( COMMAND ${LLVM_CONFIG_EXECUTABLE} --libdir OUTPUT_VARIABLE LLVM_LIBRARY_DIR OUTPUT_STRIP_TRAILING_WHITESPACE ) execute_process( COMMAND ${LLVM_CONFIG_EXECUTABLE} --cppflags OUTPUT_VARIABLE LLVM_CFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE ) execute_process( COMMAND ${LLVM_CONFIG_EXECUTABLE} --ldflags OUTPUT_VARIABLE LLVM_LFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE ) execute_process( COMMAND ${LLVM_CONFIG_EXECUTABLE} --libs core analysis jit native OUTPUT_VARIABLE LLVM_MODULE_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE )