]> git.siccegge.de Git - frida/frida.git/blob - cmake/Modules/FindLLVM.cmake
Fix redraw bug -- call prepareGeometryChange()
[frida/frida.git] / cmake / Modules / FindLLVM.cmake
1 find_program(LLVM_CONFIG NAMES llvm-config-3.5 llvm-config llvm-config-3.6)
2
3 if(LLVM_CONFIG)
4 execute_process(COMMAND ${LLVM_CONFIG} --version
5 OUTPUT_VARIABLE LLVM_VERSION)
6
7 if(((${LLVM_VERSION} VERSION_LESS 3.7.0)
8 AND (${LLVM_VERSION} VERSION_GREATER 3.5))
9 OR (${LLVM_VERSION} VERSION_EQUAL 3.5))
10
11 execute_process(COMMAND ${LLVM_CONFIG} --cxxflags
12 OUTPUT_VARIABLE LLVM_CFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
13 execute_process(COMMAND ${LLVM_CONFIG} --ldflags
14 OUTPUT_VARIABLE LLVM_LDFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
15 execute_process(COMMAND ${LLVM_CONFIG} --libs
16 OUTPUT_VARIABLE LLVM_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE)
17 execute_process(COMMAND ${LLVM_CONFIG} --system-libs
18 OUTPUT_VARIABLE LLVM_SYSTEM_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE)
19
20 string(REPLACE -O2 "" LLVM_CFLAGS ${LLVM_CFLAGS})
21 string(REPLACE -fno-exceptions "" LLVM_CFLAGS ${LLVM_CFLAGS})
22 string(REPLACE -fno-rtti "" LLVM_CFLAGS ${LLVM_CFLAGS})
23 string(REPLACE -DNDEBUG "" LLVM_CFLAGS ${LLVM_CFLAGS})
24 string(REPLACE -I "-isystem" LLVM_CFLAGS ${LLVM_CFLAGS})
25
26 separate_arguments(LLVM_CFLAGS)
27
28 if(${LLVM_VERSION} VERSION_LESS 3.6)
29 set(LLVM_CFLAGS ${LLVM_CFLAGS} -DLLVM_35)
30 set(LLVM_DYNAMIC_LIB -lLLVM-3.5)
31 else()
32 set(LLVM_CFLAGS ${LLVM_CFLAGS} -DLLVM_36)
33 set(LLVM_DYNAMIC_LIB -lLLVM-3.6)
34 endif()
35 endif()
36 endif()
37
38 if(NOT DEFINED LLVM_CFLAGS)
39 message(SEND_ERROR "LLVM 3.5 required but not found")
40 endif()