The command line generated for clang causes issues with LTO
We have a sequence of library dependencies, where a sample dependency graphs looks like:
LibA -> LibB
LibC -> LibA, LibB
We make these dependencies explicit using target_link_libraries:
target_link_libraries(libA PUBLIC libB)
target_link_libraries(libC PUBLIC libA, libB)
Our reason is that the user of libC shouldn't need to traverse the dependency graph, figure out that libA already depends on libB, and not include it. This is doubly important in the case where libA might stop depending on libB in the future.
For Clang, this results in a command line for LibC that includes LibB twice:
-llibA -llibA -llibB
This causes clang to report an error when using LTO. We expect the CMake command line generator to remove redundancies on the command line.