cmake build: Fix fallback LLVM/Clang paths

CLANG_INCLUDE_DIR and CLANG_BINDIR are the fallback paths that are used
if no bundled LLVM/Clang is found, so these must be absolute paths to
the build-time LLVM/Clang installation.

This also removes the need of copying LLVM/Clang into Qt Creator's
build directory.

Fixes: QTCREATORBUG-25147
Change-Id: I052138d894c316f493423b1da0ba79af633c4c37
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Eike Ziller
2021-01-11 13:33:48 +01:00
parent ac32cf56a1
commit 86348d5622

View File

@@ -5,8 +5,8 @@ add_qtc_library(ClangSupport
PUBLIC_DEPENDS Utils Sqlite Qt5::Core Qt5::Network
PUBLIC_DEFINES
CLANG_VERSION="${CLANG_VERSION}"
CLANG_INCLUDE_DIR="${IDE_LIBEXEC_PATH}/clang/lib/clang/${CLANG_VERSION}/include"
CLANG_BINDIR="${IDE_LIBEXEC_PATH}/clang/bin"
CLANG_INCLUDE_DIR="${LLVM_LIBRARY_DIR}/clang/${CLANG_VERSION}/include"
CLANG_BINDIR="${LLVM_TOOLS_BINARY_DIR}"
DEFINES CLANGSUPPORT_BUILD_LIB
PUBLIC_INCLUDES
"${CMAKE_CURRENT_LIST_DIR}"
@@ -146,18 +146,3 @@ add_qtc_library(ClangSupport
if (NOT TARGET libclang)
return()
endif()
# For the developer build directory
qtc_copy_to_builddir(copy_clang_to_builddir
DIRECTORIES "${LLVM_LIBRARY_DIR}/clang/${CLANG_VERSION}/include"
DESTINATION "${IDE_LIBEXEC_PATH}/clang/lib/clang/${CLANG_VERSION}/include"
)
foreach(executable clang clang-cl clangd clang-tidy clazy-standalone)
if (EXISTS "${LLVM_TOOLS_BINARY_DIR}/${executable}${CMAKE_EXECUTABLE_SUFFIX}")
qtc_copy_to_builddir(copy_clang_${executable}_to_builddir
FILES "${LLVM_TOOLS_BINARY_DIR}/${executable}${CMAKE_EXECUTABLE_SUFFIX}"
DESTINATION "${IDE_LIBEXEC_PATH}/clang/bin/"
)
endif()
endforeach()