[CMake] How to link the third party libraries into the project?

Philip Lowman philip at yhbt.com
Thu Jan 22 08:23:38 EST 2009


On Thu, Jan 22, 2009 at 5:08 AM, Ram Mulage <themulage at gmail.com> wrote:

> Thank you all for the inputs. Shall try all the suggested methods and then
> get back to you.
>
> Meanwhile I have another quick question. I am trying to build a
> library(.lib) and the directory strcture is as mentioned below.
>
> |-Lib_a
> |   -lib1
> |   -lib2
> |   -lib3
> |-Lib_b
>
> Lib_a has three sub-directories and each directory creates a .lib file. The
> requirement is to create a library(.lib) in Lib_b, which uses all the 3
> libraries created in Lib_a. How should my CMakeLists.txt in Lib_b should
> look for this requirement?


Top/CMakeLists.txt
====
add_subdirectory(Lib_a)
add_subdirectory(Lib_b)

Lib_a/CMakeLists.txt:
====
add_subdirectory(lib1)
add_subdirectory(lib2)
add_subdirectory(lib3)

Lib_a/lib1/CMakeLists.txt
====
add_library(lib1 foo.cc)

Lib_b/CMakeLists.txt
====
add_library(bar bar.cc)
target_link_librarkes(bar lib1 )

-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090122/13087981/attachment.htm>


More information about the CMake mailing list