In this patch, dependencies that are expressed in required_libraries
of LLVMBUild.txt are copied into LINK_COMPONENTS of each component's
add_llvm_library/-_target CMake call.
Notes:
- This patch is NFC, except for a minor detail: Passing LINK_COMPONENTS causes llvm_map_components_to_libnames (in cmake/modules/LLVM-Config.cmake) to verify that each LINK_COMPONENTS item actually exists. It's possible for this check to spuriously fail since components aren't added in RPO.
So an additional small change to LLVM-Config.cmake is needed to quell this error.
- lib/LineEditor/CMakeLists.txt expresses its dependence on LLVMSupport through LINK_LIBS. The patch corrects this to use LINK_COMPONENTS instead.
It would be better to use the LINK_COMPONENTS parameter to add_llvm_library rather than setting this. CMake's variable scoping behavior is non-intuitive, which can lead to bugs.