[CMake] Re: Result of FIND_LIBRARY changing its value

Eduard Bloch edi at gmx.de
Sun Nov 26 11:20:08 EST 2006


#include <hallo.h>
* Eduard Bloch [Sun, Nov 26 2006, 05:08:54PM]:
> Hello,
> 
> I have a problem with the FIND_LIBRARY directive. I need to look in
> /usr/local/lib for libraries that may be installed additionaly by user.
> But then I would like to use the libs found there and not the ones in
> default system path. Therefore, I would like to have the full path to
> the library or having -L/usr/local/lib attached only before the extra
> libraries are specified. I tried to use the value returned by
> FIND_LIBRARY. I can print it with MESSAGE() and I see
> /usr/local/lib/libiconv.a there (it's an AIX system, don't wonder). It
> seems also to work with lib lists passed with LINK_LIBRARIES.
> 
> However, when this var is passed to TARGET_LINK_LIBRARIES, it seems to
> be changed to "-liconv" in the call. It is visible with VERBOSE=1, there
> is suddenly -liconv instead of /usr/local/lib/libiconv.a .
> 
> What can I do to solve that? Adding -L/usr/local/lib to the compiler
> flags is a workaround, but is there any better way?

PS: No, adding it is not a good workaround because FIND_LIBRARY does not
care about it. So first, I would need to have a way to let the user of
the pacakge to specify his path for libs, eg. /usr/local/lib somewhere,
then pass this path(list) somehow to both, PATHS option of FIND_LIBRARY
and compiler flags. Sounds like a big cludge.

Eduard.

-- 
Geld fällt nicht vom Himmel. Man muß es sich hier auf Erden
verdienen.
		-- Margaret Thatcher


More information about the CMake mailing list