[CMake] linking to arbitrary libraries in linux.

Bill Hoffman bill.hoffman at kitware.com
Fri Feb 29 08:17:02 EST 2008

Alexander Neundorf wrote:
> On Friday 29 February 2008, David Cole wrote:
>> On 2/28/08, Alexander Neundorf <a.neundorf-work at gmx.net> wrote:
>>> target_link_libraries(targetName /full/path/to/libName.a)
>> FYI:
>> The "/full/path/to/" feature was only recently added to CVS CMake. The
>> specify lib by a full path technique may not work as you'd expect in CMake
>> 2.4.8.... If you want to use full paths in target_link_libraries calls, be
>> sure to use CVS CMake.
> No, just the behaviour has been changed, to make sure always the right library 
> is used if there are multiple libs (versions) with the same name.
> Using target_link_libraries(hello /my/custom/path/libfoo.so) is working since 
> I think very early cmake versions (that's also what find_library() returns)

This is correct.  With ALL versions of CMake, it is better to give the 
full path to a library you are linking to.


More information about the CMake mailing list