[CMake] TARGET_LINK_LIBRARIES with full path libraries

Nils Gladitz nilsgladitz at gmail.com
Thu Sep 18 02:59:02 EDT 2014


On 09/18/2014 07:52 AM, Volker Pilipp wrote:
> That actually does the trick. But it's not nice, because there are many
> targets in the project.
> Actually, I do not know about any use case, where cmake should replace a
> full path to a lib
> by its "-l" shortcut.

There are as far as I understand two use cases.

- The library does not have a SONAME
   Linking to the library by path would embed the full path of the 
library in the target rather than just the name (which is what it does 
with -l or when the library does have a SONAME set)

- The second use case I am not familiar with myself but the explanation 
in the code is:
   // Many system linkers support multiple architectures by
   // automatically selecting the implicit linker search path for the
   // current architecture.  If the library appears in an implicit link
   // directory then just report the file name without the directory
   // portion.  This will allow the system linker to locate the proper
   // library for the architecture at link time.

Nils


More information about the CMake mailing list