At 08:52 AM 5/15/2006, Michael Biebl wrote:
>On 5/15/06, William A. Hoffman <[EMAIL PROTECTED]> wrote:
>>At 06:43 AM 5/15/2006, Michael Biebl wrote:
>>>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)
>>
>>
>>What version of cmake are you using?  This is only supported in 2.4 and 
>>greater.
>
>I'm currently using 2.4.1 (and I get this error message with 2.4.1)
>but it also has to work with 2.2.

OK, I take it back, this will not work with any version of cmake.
There are several issues.

1. on windows, the static and shared libraries will clobber each other.
The shared library will create foo.dll and foo.lib.  The static library
will create foo.lib.

2. Currently the makefiles remove libfoo.* before linking the target on
unix.   This is because the target type may have been changed from shared
to static, so to be safe all types are removed.  


It is possible to change 2, but not 1.   Even if they were in different 
directories
1 would still be a problem as you could not link to foo.a anyway.   

-Bill


_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to