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

John Biddiscombe biddisco at cscs.ch
Mon May 15 06:51:57 EDT 2006


Sorry, I didn't read your mail (assumed the title was enough!) - Don't 
you want the BUILD_SHARED_LIBS option really?

> I think the last time someone asked this the answer was to use different 
> names for the internal build and add a post build rule to rename one.
> 
> JB
> 
> 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)
>>
>> 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
>> _______________________________________________
>> CMake mailing list
>> CMake at cmake.org
>> http://www.cmake.org/mailman/listinfo/cmake
> 
> 


-- 
John Biddiscombe,                            email:biddisco @ cscs.ch
http://www.cscs.ch/about/BJohn.php
CSCS, Swiss National Supercomputing Centre  | Tel:  +41 (91) 610.82.07
Via Cantonale, 6928 Manno, Switzerland      | Fax:  +41 (91) 610.82.82



More information about the CMake mailing list