[CMake] object file target

Juan Sanchez Juan.Sanchez at amd.com
Mon Jul 30 17:39:04 EDT 2007


> Did you try to make it straight-forward without any tweaking around?:
> add_library (staticarchivex STATIC ...)
> add_library (staticarchivey STATIC ...)
> add_library (sharedlibrary SHARED obj1.c obj2.c obj3.c)
> target_link_libraries(sharedlibrary staticarchivex staticarchivey)
>
>
> Any reason why that shouldn't work?
>

It might not work if the target was never intended to be a library.
Unfortunately the documentation wasn't clear on this.  I'll try it out.

Is there an easy way to tell cmake not to hide the commands it's
invoking when I type make?

Thanks,

Juan

Hendrik Sattler wrote:
> Am Montag 30 Juli 2007 22:44 schrieb Juan Sanchez:
>> It's pretty messy the Makefile I am trying to convert.  It is trying to
>> do something like this:
>> g++ -shared obj1.o obj2.o obj3.o staticarchivex.a staticarchivey.a -o
>> sharedlibrary.so
>>
>> The static archives are compiled with "-fPIC" so dynamic relocation is
>> not a problem.
>>
>> Unfortunately, this only appears to work when at least one object is
>> listed first, so I need at least one object.
>>
>> Too make a long story short.  It would be nice to just have optimal
>> dependency checking for the object files so they aren't always being
>> recompiled.  If you know how to extract the archives into a shared
>> library in a better way, I'd appreciate that info too.
> 
> Did you try to make it straight-forward without any tweaking around?:
> add_library (staticarchivex STATIC ...)
> add_library (staticarchivey STATIC ...)
> add_library (sharedlibrary SHARED obj1.c obj2.c obj3.c)
> target_link_libraries(sharedlibrary staticarchivex staticarchivey)
> 
> Any reason why that shouldn't work?
> 
> HS
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
> 
> 


-- 
Juan Sanchez
Juan.Sanchez at amd.com
800-538-8450 Ext. 54395
512-602-4395




More information about the CMake mailing list