Clean up CMake build on Mac
[WebKit-https.git] / Source / cmake / FindLLVM.cmake
1 #
2 # Check if the llvm-config gives us the path for the llvm libs.
3 #
4 # The following variables are set:
5 #  LLVM_CONFIG_EXE
6 #  LLVM_VERSION
7 #  LLVM_INCLUDE_DIRS - include directories for the llvm headers.
8 #  LLVM_STATIC_LIBRARIES - list of paths for the static llvm libraries.
9
10 find_program(LLVM_CONFIG_EXE NAMES "llvm-config")
11
12 execute_process(COMMAND ${LLVM_CONFIG_EXE} --version OUTPUT_VARIABLE LLVM_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
13 execute_process(COMMAND ${LLVM_CONFIG_EXE} --includedir OUTPUT_VARIABLE LLVM_INCLUDE_DIRS OUTPUT_STRIP_TRAILING_WHITESPACE)
14 execute_process(COMMAND ${LLVM_CONFIG_EXE} --libfiles OUTPUT_VARIABLE LLVM_STATIC_LIBRARIES OUTPUT_STRIP_TRAILING_WHITESPACE)
15
16 # convert the list of paths into a cmake list
17 separate_arguments(LLVM_STATIC_LIBRARIES)
18
19 include(FindPackageHandleStandardArgs)
20 find_package_handle_standard_args(LLVM
21                                   REQUIRED_VARS LLVM_VERSION LLVM_INCLUDE_DIRS LLVM_STATIC_LIBRARIES
22                                   VERSION_VAR LLVM_VERSION)
23
24 mark_as_advanced(LLVM_VERSION LLVM_INCLUDE_DIRS LLVM_STATIC_LIBRARIES)