No, you need to install them all: a static library only contains basically the object files of the specified sources, archived together. Auto* and libtool do some (unpleasant) magic to split and re-combine these archives, in some cases, and this is a common question on this list. If you want that behavior (and have this ability) add all the sources to your final static library.

Alternatively, you might consider using the export targets file as I mentioned in a previous email, as it will preserve transitive link dependencies: while it won't put the symbols of pear into fruit, it will make a consumer EXE of fruit also link pear.

Ryan

On 06/14/2010 02:20 PM, Torri, Stephen CIV NSWCDD, W15 wrote:
I have a question about building a project with static libraries. If you have a 
set up like the following will the final static library be the only thing that 
you install? I found that there was still unresolved external symbols when I 
only linked against Fruit.lib in the test program.

(project 1 - static)

    add_library ( Apple STATIC ${Apple_SOURCES} ${Apple_HEADERS} )

(project 2 - static)

    add_library ( Pear STATIC ${Pear_SOURCES} ${Pear_HEADERS} )

(project 3 - static)

    add_library ( Orange STATIC ${Orange_SOURCES} ${Orange_HEADERS} )

(project 4)

    add_library ( Fruit STATIC ${Fruit_SOURCES} ${Fruit_HEADERS} )

    target_link_libraries ( Fruit Apple Pear Orange )

My expectation was that I would have only one static library in the end called 
Fruit.lib with all the symbols of Apple, Pear, Orange and Fruit in it. That is 
what I see for a project that I build on a Linux system using Automake, 
Autoconf and Libtool. In the end on the Linux system I have only one static 
library that I need to install.

So my question is:

1. Do I need only to install Fruit.lib from the given project above to get all 
the symbols in the project?

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

--
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