[CMake] FIND_PATH / FIND_LIBRARY order

gga ggarra at advancedsl.com.ar
Wed Jun 13 17:54:38 EDT 2007


Bill Hoffman wrote:
> 
> /usr/local is not part of any of the systems, and has to be explicitly
> added by the user in LD_LIBRARY_PATH.

Mostly true.  Solaris and Linux's ld will also use ldconfig's paths when
searching for libraries.

> Also, the discovery of run time libraries might not always be the same
> as libraries to link....

That's why it was listed as a bug and fixed in Edgy :)

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

That example shows how to place /usr/local after.  Does not say that it
is the default or best behavior.  If anything, it implies the default
behavior is the opposite.

> 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?
> 

Somewhat agree.

I'll admit those were not the best examples.  Sigh... I went and read a
lot of manuals, which was what I wanted to avoid...

Here's a better example about /usr/local, like Debian's policy:
http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit
(see point 9.1.2).
In its policy /usr/local/lib clearly has to override /usr/lib.

BSD does not have a policy about this either, but it has also been
tradition since FreeBSD.  This probably makes OSX also follow this.

You are right however in that Solaris default tools do not touch
/usr/local at all.  Solaris policy allows it but does not seem to
enforce anything about it.  Sun is somewhat crazy as they want their
users to support /usr/swf/ for custom software, and also uses the more
standard but hardly used /opt.
Sun is a bit vague about this IMO since their documentation used to also
state that its not SysV r4 compliant and they advice you to use
/opt/local instead and turn /usr/local into a symlink pointing to it
(filesystem(5) solaris 10).
Any tool built with autoconf will still place stuff by default in
/usr/local (unless run as root).
Solaris is madness, basically :)

---

You were missing the point, however, that they do point the issue that
cmake disregards LD_LIBRARY_PATH, which is an issue.  This means
something can compile and then fail to run within the same environment,
or the other way around -- a library that is found normally is not found
by cmake.

Also, the problem right now is not that cmake does not search
/usr/local, which would be somewhat fine if it didn't.
The problem is that it does but it searches for it last, which is
certainly wrong behavior.


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

AMD4400 - ASUS48N-E
GeForce7300GT
Kubuntu Edgy


More information about the CMake mailing list