[Cmake] separate compiling and linking

William A. Hoffman billlist at nycap.rr.com
Mon, 26 Apr 2004 08:59:42 -0400


You could do something like this:
LibTopDir CMakeLists.txt:

INCLUDE(LibComponentOne/CMakeLists.txt)
INCLUDE(LibComponentTwo/CMakeLists.txt)
ADD_LIBRARY(BigLib ${LibOneSources} ${LibTwoSources})

So, remove the SUBDIRS command and only set a list of files in each LibDir.

-Bill

At 10:21 PM 4/23/2004, Iker Arizmendi wrote:
>Given the following configuration:
>
>LibTopDir
>|
>|--->CMakeLists.txt
>|
>|--->LibComponentOne
>|    |--> CMakeLists.txt
>|    |--> One.cpp, One.h, ...
>|
>|--->LibComponentTwo
>|    |--> CMakeLists.txt
>|    |--> Two.cpp, Two.h, ...
>
>
>Is there a clean way to instruct CMake to _compile_
>component objects in their respective directories
>but to link them into a single library at the
>LibTopDir level? I'm currently building a separate
>library (with ADD_LIBRARY) for each "component" to
>keep each one's source and build rules isolated from
>the rest. But in the end all of these libraries are
>used together by our client applications so it would
>make sense to just produce a single library instead
>of having client apps deal with the clutter.
>
>Thanks,
>Iker
>
>-- 
>Iker Arizmendi
>AT&T Labs - Research
>Speech and Image Processing Lab
>e: iker at research.att.com
>w: http://research.att.com
>
>
>
>_______________________________________________
>Cmake mailing list
>Cmake at www.cmake.org
>http://www.cmake.org/mailman/listinfo/cmake