[CMake] Build/Link with static libs

Filipe Sousa filipe at ipb.pt
Mon Apr 24 12:39:43 EDT 2006


Christian Lang wrote:
> Alexander Neundorf schrieb:
> 
> Hi,
> 
> my first problem is solved: To link against "foo/libbar.a", the link 
> line options "-Lfoo -lbar" are produced. This works. But what if for 
> some reason I do not want to use it this way, but want to directly 
> specify "foo/libbar.a" at the link line (as I tried in the first place)? 
> Is this possible?

You can specify the full path to libbar.a

> Regarding my second problem, I simply do not know how to tell cmake to 
> first build the static libs by recursing into the subdirs and then build 
> the main target by linking them together (at the top-level-dir)...

ADD_SUBDIRECTORY(shared_lib1)
ADD_SUBDITECTORY(shared_lib2)
ADD_SUB...

ADD_EXECUTABLE(exe ...)
TARGET_LINK_LIBRARIES(exe shared_lib1 shared_lib2 ....)


> Thanks a lot,
> Christian



-- 
Filipe Sousa

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


More information about the CMake mailing list