I'm looking for an way to decouple clang-tidy from llvm-project so that (hopefully): llvm-project are provided as only headers and shared object file to my light-weight clang-tidy project, and by adding
include_directories("${LLVM_INCLUDE_DIRS}")
link_directories("${LLVM_LIBRARY_DIRS}")
to the clang-tidy/CMakeLists.txt, the new clang-tidy compiles.
I have been searching for a while, and this repo is the closest solution I can find, yet it's outdated and can't be built without further fix. From the document I can't find clear explainations on how the whole cleaning-up was done.
Another solution in my mind would be to add set(CMAKE_EXPORT_COMPILE_COMMANDS ON) to llvm-project/llvm/CMakeLists.txt to dump build commands from CMake, and then execute each comand to generate all the intermediate files (shared objects something) and make them available to clang-tidy project. I'm not sure if it would work but it may take a long time.
Is there a better alternative to build a standalone clang-tidy project other than these 2 solutions?
To decouple clang-tidy from llvm-project, clone the clang repository separately from llvm-project. Build clang as a standalone project, and then configure clang-tidy to use the standalone clang binary. This allows independent use and updates for clang-tidy.