[CMake] Why bother with FIND_LIBRARY()
William A. Hoffman
billlist at nycap.rr.com
Wed Oct 27 16:30:12 EDT 2004
This is a known problem. It is sort of a unix linker problem.
If you use the full path to a shared library some systems force
the library to always be in that full path. I belive some linkers
if given a full path to a .a, link in the entire contents of the .a library
instead of just getting the parts they need as they do with -l and -L.
Some thoughts have been to create a directory of sym-links in the build tree
and only have one -L path.
-Bill
At 02:49 PM 10/27/2004, Eric Bolz wrote:
>I've been using FIND_LIBRARY do locate all of the libraries my project needs. I've noticed, however the libraries I find are not necessarily the ones that get linked. For example, say I do the following:
>FIND_LIBRARY(LIB_1 NAMES m PATHS /usr/lib)
>FIND_LIBRARY(LIB_2 NAMES socket PATHS /usr/local/lib)
>TARGET_LINK_LIBRARIES( my_executable ${LIB_1} ${LIB_2})
>In my Makefile, I get something like this:
>gcc -L/usr/lib -L/usr/local/lib -lm -lsocket
>
>The problem is that even though I did all the work of locating the socket library in /usr/local/lib, I can't be sure that the linker won't pick up a different one from /usr/lib
>cmake could do the following:
>gcc -l/usr/lib/libm.a -l/usr/local/lib/libsocket.a
>Why does cmake separate the library name from the path?
>This make me wonder about the value of FIND_LIBRARY(). Why bother with FIND_LIBRARY if cmake is going to ignore what I found? Is there some benefit to FIND_LIBRARY() I'm not aware of?
>
>Eric
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>_______________________________________________
>CMake mailing list
>CMake at www.cmake.org
>http://www.cmake.org/mailman/listinfo/cmake
More information about the CMake
mailing list