Commit 83016b6b authored by Kevin Funk's avatar Kevin Funk
Browse files

Prettify CMake find scripts

parent 54bc4f57
# Detect CLANG
# Detect Clang libraries
#
# Defines the following variables:
# CLANG_CLANG_LIB - LibClang library
# CLANG_CLANGFRONTEND_LIB - Clang Frontent Library
# CLANG_CLANGDRIVER_LIB - Clang Driver Library
# ...
#
# Uses the same include and library paths detected by FindLLVM.cmake
#
# See http://clang.llvm.org/docs/InternalsManual.html for full list of libraries
if (NOT LLVM_INCLUDE_DIR OR NOT LLVM_LIBRARY_DIR)
message(FATAL_ERROR "No LLVM and Clang support requires LLVM")
else (NOT LLVM_INCLUDE_DIR OR NOT LLVM_LIBRARY_DIR)
message(FATAL_ERROR "No LLVM and Clang support requires LLVM")
else()
MACRO(FIND_AND_ADD_CLANG_LIB _libname_)
macro(FIND_AND_ADD_CLANG_LIB _libname_)
string(TOUPPER ${_libname_} _prettylibname_)
find_library(CLANG_${_prettylibname_}_LIB ${_libname_} ${LLVM_LIBRARY_DIR} ${CLANG_LIB_DIR})
if (CLANG_${_prettylibname_}_LIB)
if(CLANG_${_prettylibname_}_LIB)
set(CLANG_LIBS ${CLANG_LIBS} ${CLANG_${_prettylibname_}_LIB})
endif()
ENDMACRO(FIND_AND_ADD_CLANG_LIB)
set(CLANG_INCLUDE_DIRS ${CLANG_INCLUDE_DIRS} ${LLVM_INCLUDE_DIR})
set(CLANG_INCLUDE_DIRS ${CLANG_INCLUDE_DIRS} ${CLANG_INCLUDE_DIR})
endmacro(FIND_AND_ADD_CLANG_LIB)
FIND_AND_ADD_CLANG_LIB(clang) # LibClang: high-level C interface
FIND_AND_ADD_CLANG_LIB(clangFrontend)
......@@ -39,16 +47,16 @@ FIND_AND_ADD_CLANG_LIB(clangSema)
FIND_AND_ADD_CLANG_LIB(clangRewriteCore)
if(CLANG_LIBS)
message(STATUS "Clang libs: ${CLANG_LIBS}")
set(CLANG_FOUND TRUE)
endif(CLANG_LIBS)
endif()
if(CLANG_FOUND)
message(STATUS "Found Clang: ${CLANG_INCLUDE_DIRS}")
else(CLANG_FOUND)
message(STATUS "Found Clang: ${LLVM_INCLUDE_DIR}")
message(STATUS " Libraries: ${CLANG_LIBS}")
else()
if(Clang_FIND_REQUIRED)
message(FATAL_ERROR "Could NOT find Clang")
endif()
endif(CLANG_FOUND)
endif()
endif (NOT LLVM_INCLUDE_DIR OR NOT LLVM_LIBRARY_DIR)
endif()
# Find the native LLVM includes and library
#
# Defines the following variables
# LLVM_INCLUDE_DIR - where to find llvm include files
# LLVM_LIBRARY_DIR - where to find llvm libs
# LLVM_CFLAGS - llvm compiler flags
......@@ -17,9 +18,9 @@ endif()
if (LLVM_CONFIG_EXECUTABLE)
message(STATUS "Found llvm-config: ${LLVM_CONFIG_EXECUTABLE}")
else (LLVM_CONFIG_EXECUTABLE)
else()
message(FATAL_ERROR "Could NOT find LLVM executable")
endif (LLVM_CONFIG_EXECUTABLE)
endif()
# verify that we've found the correct version of llvm-config
execute_process(COMMAND ${LLVM_CONFIG_EXECUTABLE} --version
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment