[Cmake] Re: control of order of libs

David Mellor dmellor at powerllel.com
Fri Oct 18 11:29:57 EDT 2002


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


Bill, thanks for this.
I'm afraid this doesn't quite address my problem.

Your example will created lib A, which includes B and C only because A is a
shared library. I need to produce A as a static library but have B and C
included inside it. If the SHARED keyword were removed, then A would not
include B and C. Instead, and executables compiled using A would have B and
C compiled into them at that link stage. If you need to supply someone with
library A and not burden them with also having to handle the other low level
libraries, this is awkward.

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?

Many thanks,

David





More information about the CMake mailing list