CMake Build: Fix clang binaries installation on Linux

File permissions and symlinks were not perserved.

Change-Id: Id5ba57fba2834f2297125de68af837f5d68eea2f
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Cristian Adam
2020-02-07 15:17:35 +01:00
committed by Alessandro Portale
parent eadfe1a421
commit 8bef0c9155

View File

@@ -141,13 +141,16 @@ add_qtc_library(ClangSupport
writemessageblock.cpp writemessageblock.h writemessageblock.cpp writemessageblock.h
) )
add_custom_target(copy_clang_to_builddir if (NOT TARGET libclang)
return()
endif()
add_custom_target(copy_clang_to_builddir ALL
COMMENT Copy Clang files into build directory COMMENT Copy Clang files into build directory
) )
add_dependencies(ClangSupport copy_clang_to_builddir) # For the developer build directory
add_custom_command(TARGET copy_clang_to_builddir POST_BUILD
add_custom_command(TARGET copy_clang_to_builddir PRE_BUILD
COMMAND "${CMAKE_COMMAND}" COMMAND "${CMAKE_COMMAND}"
-E make_directory -E make_directory
"${PROJECT_BINARY_DIR}/${IDE_LIBEXEC_PATH}/clang/lib/clang/${CLANG_VERSION}" "${PROJECT_BINARY_DIR}/${IDE_LIBEXEC_PATH}/clang/lib/clang/${CLANG_VERSION}"
@@ -170,10 +173,20 @@ foreach(executable clang clang-cl clangd clang-tidy clazy-standalone)
"${PROJECT_BINARY_DIR}/${IDE_LIBEXEC_PATH}/clang/bin/" "${PROJECT_BINARY_DIR}/${IDE_LIBEXEC_PATH}/clang/bin/"
VERBATIM VERBATIM
) )
install(
FILES "${LLVM_TOOLS_BINARY_DIR}/${executable}${CMAKE_EXECUTABLE_SUFFIX}" # For the install directory
DESTINATION "${IDE_LIBEXEC_PATH}/clang/bin" install(PROGRAMS
) "${LLVM_TOOLS_BINARY_DIR}/${executable}${CMAKE_EXECUTABLE_SUFFIX}"
DESTINATION "${IDE_LIBEXEC_PATH}/clang/bin"
)
if (IS_SYMLINK "${LLVM_TOOLS_BINARY_DIR}/${executable}${CMAKE_EXECUTABLE_SUFFIX}")
file(READ_SYMLINK
"${LLVM_TOOLS_BINARY_DIR}/${executable}${CMAKE_EXECUTABLE_SUFFIX}" real_executable)
install(PROGRAMS
"${LLVM_TOOLS_BINARY_DIR}/${real_executable}${CMAKE_EXECUTABLE_SUFFIX}"
DESTINATION "${IDE_LIBEXEC_PATH}/clang/bin"
)
endif()
endif() endif()
endforeach() endforeach()