[CMake] Building a "mega" library after building smaller component libraries?

Clifford Yapp cliffyapp at gmail.com
Mon Dec 13 19:37:26 EST 2010


Ah, I'm informed that what I was after was this:

http://www.cmake.org/Wiki/CMake_FAQ#Does_CMake_support_.22convenience.22_libraries.3F

and I won't be able to duplicate this result with CMake (at least,
using that mechanism.)

CY

On Mon, Dec 13, 2010 at 6:13 PM, Clifford Yapp <cliffyapp at gmail.com> wrote:
> Can anyone tell me what the best way is (without a whole lot of
> rebuilding) to take several individual libraries and combine them into
> a single large library?
>
> In our autotools Makefile.am, we have the following:
>
> libbrlcad_la_SOURCES =
> libbrlcad_la_LDFLAGS = -version-info 19:1
> libbrlcad_la_LIBADD = libbrlcad_nil.la
>
> libbrlcad_nil_la_SOURCES =
> libbrlcad_nil_la_LIBADD = \
>        $(top_builddir)/src/libbu/libbu_nil.la \
>        $(top_builddir)/src/libbn/libbn_nil.la \
>        $(top_builddir)/src/librt/librt_nil.la \
>        $(top_builddir)/src/libwdb/libwdb_nil.la \
>        $(top_builddir)/src/libged/libged_nil.la
>
> If I'm not mistaken, this appears to build static and dynamic
> libbrlcad.a/libbrlcad.dylib/libbrlcad.so/etc. libraries using the
> already built libbu, libbn, etc. libraries, without recompiling
> anything.
>
> I have successfully built all of the component libraries using CMake
> both STATIC and SHARED, but I am a bit puzzled as to how to combine
> them all into the monster library.  I can't define an add_library
> target without source files - is there some other way to approach
> this?  The arguments against reusing object files don't come into it
> here, since the whole point is to combine what was already built into
> a single large library.
>
> Sorry if the question is basic but I may not even be using the right
> terminology to search for what I want to do here.  Thanks for any
> help.
>
> CY
>


More information about the CMake mailing list