[CMake] Link directories order

Bill Hoffman bill.hoffman at kitware.com
Wed Nov 7 10:57:31 EST 2007


Renaud Detry wrote:
>> OK, CMake does not know what you are doing here.  It is treating 
>> LDFLAGS like some linker flag.  The idea was something like -64 or 
>> some other linker specific flag for a platform.
> 
> Ok.
> 
>> If you inject directories into the link line, you are sort of out of 
>> luck.  Why are you doing it this way?
> 
> What other way could I do it?
> 
> - There's no official definition of what should be found in LDFLAGS,
>   but most of the software that use LDFLAGS (in particular autotools)
>   expect you to put non-standard link directories in there.
> 
You should be using FIND_LIBRARY to find the things you want to link in, 
or at least finding the directory with a FIND_FILE, and then using 
LINK_DIRECTORIES. LDFLAGS is a bad idea because your users will also 
have to set this to get it to work.

> - Isn't it the most standard way (in unix) to tell a build system to look
>   for libraries in non-standard places?

With CMake you should be telling CMake which libraries you want to use. 
   I suppose we could attempt to parse the LDFLAGS variable.  Feel free 
to make a feature request, but it won't work for any version of CMake 
currently out.

-Bill


More information about the CMake mailing list