I'm trying to statically link libclang in one of my tools . The problem I have is to get the correct order of the LLVM and libclang libraries when linking. On macOS it seems I can pass the libraries to the linker in any order but that doesn't work on Linux.
I've looked at llvm-config, but that doesn't contain any information about libclang, only LLVM. I've tried specifying the order of the libraries exactly as specified in "tools/clang/tools/libclang/CMakeFiles/libclang.dir/link.txt" after invoking cmake and that works.
Is there a way to get/extract the correct order of the libraries programmatically without having to hard code the order? Ideally something that works across different versions of libclang.