[CMake] merge static libraries with ar
Brandon Van Every
bvanevery at gmail.com
Sat Jul 28 12:05:26 EDT 2007
On 7/28/07, Timur Ivanov <timur.ivanov at gmail.com> wrote:
> Hello again :)
>
> Suppose i have
>
> ADD_SUBDIRECTORY(foo) # produce libfoo.a
> ADD_SUBDIRECTORY(bar) # produce libbar.a
> ADD_SUBDIRECTORY(baz) # produce libbaz.a
>
> Now i need to merge all of them into single library libcool.a. Would
> you like to give me some hints for that task ?
You can't. AR itself does not support static libraries that contain
static libraries. What you have to do, is find all the object files
for those libraries, and combine them into your final libcool.a. This
requires special knowledge of where CMake has put the object files,
there's no standard interface for it. Chicken does all of this with
the PCRE libraries so that the object files don't have to be
recompiled over and over again, and so that the user doesn't have to
link against libpcre. This is called "faking a convenience library."
See the Chicken build for details.
http://www.call-with-current-continuation.org/
Cheers,
Brandon Van Every
More information about the CMake
mailing list