On Thu 2008-11-06 21:03, Jed Brown wrote:
> On Thu 2008-11-06 13:18, Bill Hoffman wrote:
> > Jed Brown wrote:
> >
> >> The FindPkgConfig.cmake module looks broken too, it assumes that
> >>
> >>   -L/A -la -L/B -lb
> >>
> >> is equivalent to
> >>
> >>   -L/A -L/B -la -lb
> >>
> > I don't see where the above would fail.

This can also fail, but I should have written

  -L/B -L/A -la -lb

since the existing modules are doing two things wrong.  When the
compiler parses the link line, it builds a stack of libraries to search.
This stack must be searched incrementally.

In the original example (-L/A -la -L/B -lb) the linker will look for
liba.{so,a} in /A, then in system directories.  It will look for
libb.{so,a} in /B, then in /A, then in system directories.

The existing CMake modules are passing the complete list of directories
as HINTS when looking for every library.  This is wrong because the
linker only searches those directories appearing *before* the lib.

The existing CMake modules are passing the libraries to find_library()
in the order they appear on the command line.  This is wrong because
find_library() searches HINTS in forward order while the linker searches
the stack starting from the top (i.e. reverse order as they appear on
the command line).


Jed

Attachment: pgp0htdyOP9vc.pgp
Description: PGP signature

_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to