[CMake] how to make a static and shared lib at the same time?

Prakash Punnoor lists at punnoor.de
Sun Nov 20 11:11:11 EST 2005


Hi,

I basically want libtool behaviour which creates static and shared libs
at the same time. This sound like an easy task but I haven't been able
to achieve this with cmake w/o rebuilding the whole sources for the
second version lib. :-/

Here is what I tried:

ADD_LIBRARY(openal-static STATIC ${OPENAL_OBJS})
SET_TARGET_PROPERTIES(openal-static PROPERTIES OUTPUT_NAME openal)
SET_TARGET_PROPERTIES(openal-static PROPERTIES LINKER_LANGUAGE C)
TARGET_LINK_LIBRARIES(openal-static ${ADD_LIBS})

ADD_LIBRARY(openal SHARED ${OPENAL_OBJS})
SET_TARGET_PROPERTIES(openal PROPERTIES LINKER_LANGUAGE C)
SET_TARGET_PROPERTIES(openal PROPERTIES VERSION ${PACKAGE_VERSION}
SOVERSION ${PACKAGE_MAJOR_VERSION})

This doesn't work as expected. For building the shared lib, the sources
get recompiled. Futhermore The OUTPUT_NAME stuff doesn't seem to work.
The lib is named openal-static.

In case you are wondering, I am trying to give OpenAL a cmake build
system. I already commited a first (incomplete) version.

Cheers,

Prakash
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://public.kitware.com/pipermail/cmake/attachments/20051120/c87cafea/signature.pgp


More information about the CMake mailing list