[CMake] Linking with -l and -L flags

Moreland, Kenneth kmorel at sandia.gov
Thu Jan 12 12:46:49 EST 2006


I have noticed that for Unix makefile generators, when you specify the
path of a library with LINK_LIBRARIES or TARGET_LINK_LIBRARIES, the path
is converted to -L and -l flags in the link line?  Is there a good
reason to do this versus just adding the full path of the library to the
link line?

I am arguing that this is the wrong behavior.  The problem is that
sometimes I'll specify a specific library, but the linker will actually
load in a different one with the same name but is nonetheless not
compatible with my build.  Current example: I am trying to compile
ParaView on my Mac with static libraries (to make distribution easier).
It compiles its own static Tck/Tk libraries, but the linker grabs the
system Tck/Tk libraries because they are dynamic.  The resulting
executable crashes because the system Tcl/Tk libraries use a different
graphics API.

Right now I can find no choice but to modify the makefiles that are
built.  Is there a better solution?

-Ken

   ****      Kenneth Moreland
    ***      Sandia National Laboratories
***********  
*** *** ***  email: kmorel at sandia.gov
**  ***  **  phone: (505) 844-8919
    ***      fax:   (505) 845-0833



More information about the CMake mailing list