[CMake] FIND_PATH / FIND_LIBRARY order

Bill Hoffman bill.hoffman at kitware.com
Wed Jun 13 16:23:05 EDT 2007


gga wrote:
> Bill Hoffman wrote:
>   
>>>   
>>>       
>> So, I guess it depends on the UNIX system you are using...  Say on
>> Solaris or HPUX I would
>> expect /usr to come before /usr/local, at least for the system
>> compiler.
>>     
>
> AFAIK, that's not right.  HPUX and Solaris work just like every other
> Unix distro, and /usr/local is expected to override /usr.
> LD_LIBRARY_PATH is also expected to override either.  Solaris also can
> use RPATH to override paths (has less precedence than LD_LIBRARY_PATH).
> SGI uses LD_LIBRARY_PATH, LD_LIBRARYN32_PATH and LD_LIBRARYN64_PATH
> (depending on architecture).
> AIX uses LIBPATH instead.
>
>
> See for example (Solaris):
> http://prefetch.net/blog/index.php/2005/10/06/viewing-shared-library-search-order/
>   
So, this example shows that LD_LIBRARY_PATH is searched for run time 
libraries, and the user happened
to have /usr/local/lib in LD_LIBRARY_PATH.   If you did not put it in 
LD_LIBRARY_PATH, the OS would
not know anything about it at all.

> http://prefetch.net/blog/index.php/category/solaris-linker/
>   
This one says:

1. Check for libraries by traversing the directories in the 
LD_LIBRARY_PATH environment variable

2. Check for libraries by traversing the directories in the executabless 
RPATH

3. Check for libraries by traversing /lib and /usr/lib


/usr/local is not part of any of the systems, and has to be explicitly 
added by the user in LD_LIBRARY_PATH.
Also, the discovery of run time libraries might not always be the same 
as libraries to link....

https://bugs.launchpad.net/binutils/+bug/40214

HP seems to suggest that /usr/local/lib should come after /usr/lib:
http://docs.hp.com/en/B2355-90654/ch03s07.html

I guess my take is that most system tools like ld and such don't even 
know about /usr/local/lib, so
why should cmake search there first?

-Bill







More information about the CMake mailing list