[CMake] putting object files in a seperate direcotry OR combining
static libraries
Alexander Neundorf
a.neundorf-work at gmx.net
Mon Dec 4 07:52:05 EST 2006
Von: "Kiran Pradeep" <kiran.happy at gmail.com>
> Hi All,
>
> I use cmake to in project with only 1 level of subdirectory.
> In each of those subdirectories i have a CMakeLitst.txt which creates a
> static library out of its source files and put them in a single common
> directory.
> Finally the main CmakeLists.txt will use all those lindividual static
> libraries to create the application. Now there is a requirement like,
> i want to combine all those individual static libraries to a single
> static or shared library. I know i have to run "ar x library.a" to get
> back the
Is there a reason why you want to do that ?
You can also simply set some variables which will contain the lists of source files, and then combine these to libs and apps as you want:
set(foolibSrcs src1/foo.c src1/foo2.c)
set(barlibSrcs src2/bar.c src1/bar2.c)
add_library(foolib_static STATIC ${foolibSrcs})
add_library(foolib_dyn SHARED ${foolibSrcs})
add_library(barlib_dyn SHARED ${barlibSrcs})
add_library(all_in_one SHARED ${foolibSrcs} ${barlibSrcs})
add_executable(blub main.c ${foolibSrcs} ${barlibSrcs})
Bye
Alex
--
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
More information about the CMake
mailing list