ok, I think I have this working, thanks. I am building static version of "foo" as well. Before, I could just archive in this composite object. How is the best way to do that?
Here is my current cmake pseudo-code of what I have come up with? Note, SOURCES has list of files adding to shared lib set SOURCES-static ${SOURCES} file(GLOB subdira-sources subdira/*.c) list(APPEND SOURCES-static ${subdira-sources}) then add_library(foo-static STATIC ${SOURCES-static}) I have several composite objects like this.Is there a better way? Doug On Thu, May 27, 2010 at 11:32 AM, Torri, Stephen CIV NSWCDD, W15 <stephen.to...@navy.mil> wrote: >> From: cmake-boun...@cmake.org on behalf of Doug Reiland >> Sent: Thu 5/27/2010 11:14 AM >> To: cmake@cmake.org >> Subject: [CMake] cmake - library help >> >> First, I am new to cmake and exploring converting our home grown build >> system. >> How would I code this up in cmake >> I have composite objects that need to be added to a share library >> add_library(foo a.c b.c c.c) > > Use the keyword 'SHARED' to indicate you need shared library: > > add_library (foo SHARED a.c b.c c.c) > >> I also need x.o in the library AND x.o linked from: >> subdir-a/aa.c subdir-a/bb.c > > If the subdirectories have a project named in a CMakeLists.txt you can just > tell cmake to link the library in: > > So if subdir-a has a project like: > > cmake_minimum_required(VERSION 2.6) > add_library (subA aa.c bb.c ) > > then you can link subA inside the other project. For example say the 'foo' > library needs to statically link in subA. > > add_library ( foo SHARED a.c b.c c.c) > link_libraries ( subA ) > > Stephen > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Follow this link to subscribe/unsubscribe: > http://www.cmake.org/mailman/listinfo/cmake > _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake