[Cmake] VXL/cmake cygwin build: link line -l option order

Wheeler, Fred (Research) wheeler at crd.ge.com
Fri May 10 09:23:28 EDT 2002


VXL and CMake lists:

I'm trying to get a clean VXL build with cygwin/gcc-2.95.3-5.  Has
anyone else done this?  I'm having trouble with the link "-l" options
and their order.

It looks like on this system the link line library order is important.
If lib B depends on lib A, then "-lA -lB" will not work, I have to use
"-lB -lA".  I seem to recall that is also a requirement on some hpux
systems.

CMake seems to be emitting a "-l" option for each library only once.
That would seem to be an improvement over the very long link lines of
the past.  However, it is now causing me grief.

I have been able to fix most of these problems in VXL by swapping
INCLUDE lines in various CMakeLists and CMakeListsLinks files.  But,
there are (or at least can be) situations where this will not work.

An example of the problem is when a target needs libraries B and C,
and adds them with CMakeListsLink files that in turn use
LINK_LIBRARIES commands.  Suppose both B and C in turn depend on
library A.  Then, without removing duplicates, cmake would emit "-lB
-lA -lC -lA", but removing duplicates, cmake emits "-lB -lA -lC".  The
2nd "-lA" is a duplicate, so it is removed.  Now, C comes after A, so
there are unresolved symbols at link time.

If duplicates were removed from the right to the left, this would not
be a problem.

Does anyone know how to kludge cmake so no duplicates are eliminated?
Any other comments/ideas?

Thanks,
Fred Wheeler

--
Fred Wheeler, GE CRD, KWC-303
Phone: 518-387-7225 (GE Internal Dialcom: 8*833-7225)
Fax:   518-387-4042 (GE Internal Dialcom: 8*833-4042)



More information about the CMake mailing list