Use NeverDestroyed instead of DEPRECATED_DEFINE_STATIC_LOCAL
[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
11 foreach (_program_name llvm-config llvm-config-3.7 llvm-config-3.6 llvm-config-3.5)
12     find_program(LLVM_CONFIG_EXE NAMES ${_program_name})
13     if (LLVM_CONFIG_EXE)
14         execute_process(COMMAND ${LLVM_CONFIG_EXE} --version OUTPUT_VARIABLE LLVM_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
15         if ("${LLVM_VERSION}" VERSION_LESS "${LLVM_FIND_VERSION}")
16             unset(LLVM_CONFIG_EXE CACHE)
17         else ()
18             break ()
19         endif ()
20     endif ()
21 endforeach ()
22
23 execute_process(COMMAND ${LLVM_CONFIG_EXE} --includedir OUTPUT_VARIABLE LLVM_INCLUDE_DIRS OUTPUT_STRIP_TRAILING_WHITESPACE)
24 execute_process(COMMAND ${LLVM_CONFIG_EXE} --libfiles OUTPUT_VARIABLE LLVM_STATIC_LIBRARIES OUTPUT_STRIP_TRAILING_WHITESPACE)
25 execute_process(COMMAND ${LLVM_CONFIG_EXE} --system-libs OUTPUT_VARIABLE LLVM_SYSTEM_LIBRARIES OUTPUT_STRIP_TRAILING_WHITESPACE)
26
27 # convert the list of paths into a cmake list
28 separate_arguments(LLVM_STATIC_LIBRARIES)
29
30 include(FindPackageHandleStandardArgs)
31 find_package_handle_standard_args(LLVM
32                                   REQUIRED_VARS LLVM_VERSION LLVM_INCLUDE_DIRS LLVM_STATIC_LIBRARIES
33                                   VERSION_VAR LLVM_VERSION)
34
35 mark_as_advanced(LLVM_VERSION LLVM_INCLUDE_DIRS LLVM_STATIC_LIBRARIES)