Commit ad0cbbb8 authored by Kevin Funk's avatar Kevin Funk

cmake: FindClang: Detect llvm-project.git checkout

llvm-project.git (the new recommended way to clone the LLVM project(s))
has a different layout than the previous Git mirror. Adhere to and use
the correct clang include path in the checkout's source dir. Without
this patch we fail to find the 'clang-c/Index.h' include.
parent ff8dc1f0
......@@ -128,8 +128,17 @@ if(CLANG_FOUND)
message(STATUS "Detected that llvm-config comes from a build-tree, adding more include directories for Clang")
list(APPEND CLANG_INCLUDE_DIRS
"${LLVM_INSTALL_PREFIX}/tools/clang/include" # build dir
"${_llvmSourceRoot}/tools/clang/include" # source dir
)
# check whether the source is from llvm-project.git (currently recommended way to clone the LLVM projects)
# contains all LLVM projects in the top-level directory
get_filename_component(_llvmProjectClangIncludeDir ${_llvmSourceRoot}/../clang/include REALPATH)
if (EXISTS ${_llvmProjectClangIncludeDir})
message(STATUS " Note: llvm-project.git structure detected, using different include path pointing into source dir")
list(APPEND CLANG_INCLUDE_DIRS "${_llvmProjectClangIncludeDir}") # source dir
else()
list(APPEND CLANG_INCLUDE_DIRS "${_llvmSourceRoot}/tools/clang/include") # source dir
endif()
endif()
message(STATUS "Found Clang (LLVM version: ${CLANG_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