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.
To be honest, I'm not convinced about this. Do I understand correctly that this code means to ensure case-insensitive mapping of libraries to their correct names? If it's not possible to do that reliably, I'd rather not do that at all and instead require people to write out correct names.
For a start, do you think it'd be possible to record all hits of this branch and check them later on? I'm thinking of checking any possible mismatches at the end of CMake, so if the canonicalization can't work, developers get to fix their case anyway.