This is a pretty frequently asked question - the short answer is, if you are building all the libraries yourself, just add all the source files to a single cmake static library, otherwise install a ____-config.cmake file that will automatically set a dependency. Trying to do this apparently auto*-y ar trick is possible but ugly and "not the right way to do it".

Ryan

On 04/28/2010 02:57 PM, Eric Nodwell wrote:
Is there any way to have CMake make a new static library that includes the 
objects from another existing static library?

As an example (here a Linux-specific example) of doing this manually, suppose I have an existing library 
"libA.a", as well as an object file "B.o" that I have just compiled, and I want to 
combine the two of them into a single static library named "libB.a" .  By hand I could do this:

ar xv libA.a      # generates an A.o or something similar
ar rcs libB.a B.o A.o

Can this be done (in a cross-platform way) with CMake commands?

(Of course, if I have access to the source code for A, this is simple, but that 
may not always be the case.)

Thank you for any tips,
Eric

_______________________________________________
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

--
Ryan Pavlik
HCI Graduate Student
Virtual Reality Applications Center
Iowa State University

rpav...@iastate.edu
http://academic.cleardefinition.com
Internal VRAC/HCI Site: http://tinyurl.com/rpavlik

_______________________________________________
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

Reply via email to