[CMake] TARGET_LINK_LIBRARIES question
david.rhoda at kodak.com
david.rhoda at kodak.com
Tue Apr 10 15:56:34 EDT 2007
> On Tuesday 10 April 2007 20:22, david.rhoda at kodak.com wrote:
> > I would like to be able to add the full path to the library via
> > TARGET_LINK_LIBRARIES. I have looked through the documentation but
have
> > not found a way to this.
> >
> > When I TARGET_LINK_LIBRARIES( test /path/to/libA.lib) I get the
equivalent
> > of -L /path/to -l libA.lib. I'd like to get -l /path/to/libA.lib. Is
> > that possible?
>
> Currently this is not possible. You also shouldn't need it. CMake orders
the
> directories so that you should get the libs you want.
> Do you have a case where this doesn't work ?
>
> Bye
> Alex
> --
Alex, thanks for the quick reply. I've been typing a response to show you
an example of where it doesn't work. In that process I've come to the
conclusion that my problem may not be CMake.
This is what I started typing:
My situation is a bit convoluted. First, I'm using VS 2005. I'm working
on a team of several developers. We have an area where we keep "released"
libraries. Let's call this c:/path/to/releasedLibs. There are many
libraries stored there. Let's call a couple of those libA.lib and
libB.lib. Most of the time, that's where I want to get the libraries when
I link. However, sometimes I need to change libA.lib but I'm not ready
for every one else to use my new libA.lib. I change my FIND_LIBRARY call
to FIND_LIBRARY( LIBA NAMES libA PATHS c:/path/to/davesLibs). I still
have FIND_LIBRARY(LIBB NAMES libB PATHS c:/path/to/releasedLibs) I
configure and the variables LIBA and LIBB are set properly:
c:/path/to/davesLibs/libA.lib and c:/path/to/releasedLibs/libB.lib,
respectively. When I hit OK to build the vcproj files I get an error that
tells me "It is impossible to order the linker search path in such a way
that libraries specified as full paths will be picked by the linker."
When I looked more closely at the error, I saw that I had a libB.lib in
c:/path/to/davesLibs that was left over from previous work. CMake got
confused because of the multiple libB.lib's even though the LIBB variable
was set properly. I guess that was the confusing part. Still,
everything would have worked as I expected if TARGET_LINK_LIBRARIES added
the full path to the library to the linker's command line.
Again, thanks for your help.
Dave
More information about the CMake
mailing list