[Cmake] Re: control of order of libs

Andy Cedilnik andy.cedilnik at kitware.com
Fri Oct 18 14:02:47 EDT 2002


Hi Bill and David,

Let say you are trying to do libFoo.a which contains libBar.a.

Can't you just do

ar cr libFoo.a foo.o libBar.a

If that is the case, then try this:

SET(LIB_SUFFIX "a")
SET(LIB_PREFIX "lib")
IF(WIN32)
  IF(NOT CYGWIN)
    SET(LIB_PREFIX "")
    SET(LIB_SUFFIX ".lib")
  ENDIF(NOT CYGWIN)
ENDIF(WIN32)

ADD_LIBRARY(Bar bar.cxx)
ADD_LIBRARY(Foo foo.o ${BINARY_PATH}/${LIB_PREFIX}Bar${LIB_SUFFIX})
SET_SOURCE_FILES_PROPERTIES(
${BINARY_PATH}/${LIB_PREFIX}Bar${LIB_SUFFIX} GENERATED)

Huh, if this works, let us know.

If this does not work, you can always do custom command tricks.

			Andy

On Fri, 2002-10-18 at 13:25, Bill Hoffman wrote:
> I do not think it is possible, in fact, I did not think it was possible to
> combine two static libraries from the command line.  How do you do that?
> I don't think the ar command takes -l arguments.    You may be able to do
> this with a custom command that modifies the library after the build.





More information about the CMake mailing list