diff options
author | Yang Rong <rong.r.yang@intel.com> | 2013-05-23 13:48:46 +0800 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@linux.intel.com> | 2013-05-23 13:51:20 +0800 |
commit | 34ed7dbf95eae804655869828e4544366cc4b54b (patch) | |
tree | 116ed06bd73f3ae9d43ce6487231d17a91538690 /CMake | |
parent | 5fb4ca0755d62ba62e30f17511b1314ade5c017d (diff) |
Change clang system call to libclang api call.
The original call clang command directly as frontend. The implement is not very flexible.
I change to call libclang apis, support both clang 3.1 and clang 3.2.
Now still write the intermediate to the file, for code simply.
Signed-off-by: Yang Rong <rong.r.yang@intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Diffstat (limited to 'CMake')
-rw-r--r-- | CMake/FindLLVM.cmake | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/CMake/FindLLVM.cmake b/CMake/FindLLVM.cmake index c06b8a48..b3206391 100644 --- a/CMake/FindLLVM.cmake +++ b/CMake/FindLLVM.cmake @@ -8,7 +8,7 @@ # LLVM_FOUND - True if llvm found. if (LLVM_INSTALL_DIR) find_program(LLVM_CONFIG_EXECUTABLE NAMES llvm-config-32 llvm-config-3.2 llvm-config DOC "llvm-config executable" PATHS ${LLVM_INSTALL_DIR} NO_DEFAULT_PATH) -else (LLVM_INSTALL_DIR) +else (LLVM_INSTALL_DIR) find_program(LLVM_CONFIG_EXECUTABLE NAMES llvm-config-32 llvm-config-3.2 llvm-config DOC "llvm-config executable") endif (LLVM_INSTALL_DIR) @@ -66,3 +66,28 @@ execute_process( OUTPUT_VARIABLE LLVM_MODULE_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE ) + +macro(add_one_lib name) + FIND_LIBRARY(CLANG_LIB + NAMES ${name} + PATHS ${LLVM_LIBRARY_DIR} ) + set(CLANG_LIBRARIES ${CLANG_LIBRARIES} ${CLANG_LIB}) + unset(CLANG_LIB CACHE) +endmacro() + +#Assume clang lib path same as llvm lib path +add_one_lib("clangFrontend") +add_one_lib("clangSerialization") +add_one_lib("clangDriver") +add_one_lib("clangCodeGen") +add_one_lib("clangSema") +add_one_lib("clangStaticAnalyzerFrontend") +add_one_lib("clangStaticAnalyzerCheckers") +add_one_lib("clangStaticAnalyzerCore") +add_one_lib("clangAnalysis") +add_one_lib("clangEdit") +add_one_lib("clangAST") +add_one_lib("clangParse") +add_one_lib("clangSema") +add_one_lib("clangLex") +add_one_lib("clangBasic") |