[CMake] FIND_PATH / FIND_LIBRARY order

gga ggarra at advancedsl.com.ar
Wed Jun 13 16:08:31 EDT 2007


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/
http://prefetch.net/blog/index.php/category/solaris-linker/



>  It seems a bit dangerous
> to have a system that has different versions of things in /usr and
> /usr/local, and to expect the
> /usr/local one to be picked first.

No. Why?  /usr/local is still a sudo or admin protected directory (or
should be), so your average user cannot screw it up.
It allows developers (and sometimes normal users) to have a sandbox to
test their stuff without screwing up the rest of the facility.
Any error or weird behavior can be checked with ldd on most unices.

In the dark ages of computing, when a 2-3Gb hard disk was a luxury and
10baseT was the fastest thing around, it was not uncommon to have
/usr/bin and /usr/lib be a network directory in some server while
/usr/local remained local to the machine (hence the name of the dir).

Today, with linux distros, this concept is still used.  It allows you to
have your own installed stuff on your machine without screwing up with
the stuff the package manager for the distro handles.

-- 
Gonzalo Garramuño
ggarra at advancedsl.com.ar

AMD4400 - ASUS48N-E
GeForce7300GT
Kubuntu Edgy


More information about the CMake mailing list