[CMake] target_link_libraries replacing fully-qualified library with -l<x>

Alexander Neundorf a.neundorf-work at gmx.net
Wed Jan 28 16:58:57 EST 2015


On Wednesday, January 28, 2015 14:12:03 Chris Green wrote:
> Hi,
> 
> I've been trying to run down a problem with our cmake-based build system
> that appears to be a result of a target_link_libraries(...) invocation
> taking a fully qualified shared library location and replacing it with
> -l<lib>. Since we're trying very hard to avoid picking up unwanted,
> older copies of this library from system areas, this is causing us quite
> some angst.
> 
> The command:
> 
> target_link_libraries(<target> /X/Y/libtbb.so)
> 
> results in link.txt files containing -ltbb.
> 
> I wasn't able to find anywhere in documentation that mentioned this was
> a possible behavior of target_link_libraries, which is why it took us so
> long to trace it down to this in particular.
> 
> So, my questions:
> 
>  1. Is this a bug?
>  2. If not a bug, what is the rationale for this behavior, and under
>     what circumstances does this behavior get triggered?
>  3. Is it possible to deactivate this behavior?
>  4. If not, can it be made possible to deactivate this behavior?

IIRC, this is done if the directory /X/Y/ is part of some environment 
variable, I think it was LIBRARY_PATH.

Alex



More information about the CMake mailing list