[CMake] creating a shared and static library of the same name

Michael Biebl mbiebl at gmail.com
Mon May 15 06:43:52 EDT 2006


Hi everybody,

is it possible to create a shared and static library with the same name?
I tried the folllowing:

ADD_LIBRARY(foo SHARED foo.c)

ADD_LIBRARY(foo_static STATIC foo.c)
SET_TARGET_PROPERTIES(foo_static PROPERTIES OUTPUT_NAME foo)

But if I then add

ADD_EXECUTABLE(bar bar.c)
TARGET_LINK_LIBRARIES(bar foo)  (I want to link it dynamically against
libfoo.so)

I get the error:

make[2]: *** No rule to make target `libfoo.so', needed by `bar'.  Stop.

Can anyone tell me, what I'm doing wrong and how I can fix this.

TIA,
Michael


More information about the CMake mailing list