[Cmake] Re: control of order of libs

Amitha Perera perera at cs.rpi.edu
Fri Oct 18 11:58:49 EDT 2002


"David Mellor" <dmellor at powerllel.com> writes:
> >It would be something like this:
> >
> >ADD_LIBRARY(B STATIC ${B_SRCS})
> >ADD_LIBRARY(C STATIC ${C_SRCS})
> >ADD_LIBRARY(A SHARED ${A_SRCS})
> >TARGET_LINK_LIBRARIES(A B C)
> 
[...]
> 
> I do not need to compile up B and C myself as in your example - these are
> libraries from a 3rd party.
> 
> Is it possible for me to pull in my libraries with ADD_LIBRARY rather than
> with TARGET_LINK_LIBRARY?

Presumably, then, you know the link line to achieve this. (In an
earlier post, you mentioned that you could edit the generated
Makefiles by hand.) You could simply pass the appropriate magic to
TARGET_LINK_LIBRARIES:

  TARGET_LINK_LIBRARIES( A "-include-these-ones-too B C" )

The ADD_LIBRARY only contains the sources that you need to compile for
the library. Since B and C are third party, they are presumably
already compiled, and don't need to be compiled into A.

Amitha.



More information about the CMake mailing list