target_link_libraries: SONAME detection of .so files broken for ld scripts
When target_link_libraries
is given an absolute path like /usr/lib/x86_64-linux-gnu/libm.so
to a shared library, the logic in cmComputeLinkInformation::CheckSharedLibNoSOName
uses cmSystemTools::GuessLibrarySOName
to detect whether the .so
has a SONAME
or not. If the .so
does not have a SONAME
then on some platforms we link via -lm
instead of the absolute path in order to prevent the absolute path from being stored in the dependent's NEEDED
field. However, this logic breaks when the .so
file is actually a GNU ld script, as is the case with /usr/lib/x86_64-linux-gnu/libm.so
on some Linux distros.