Re: [CMake] Creating a library from subdirectories

2014-11-26 Thread Stephen Kelly
Chris Johnson wrote: > * I do not want to use the add_library(component1 OBJECT > ${component1_sources}) and add_library(toplevel > $ ... ) syntax if it can be avoided. Is the constraint that you want a top-level something like # All components: set(components component1 component2) fore

Re: [CMake] Creating a library from subdirectories

2014-11-26 Thread J Decker
So a) add_library( OBJECT) you could add a custom target and rename big to big_part add_custom_target( big ) add_custom_command( TARGET big OUTPUT bigl.a DEPENDS big_part A B COMMAND ... ) ties you to a platform though why are you conglo

Re: [CMake] Creating a library from subdirectories

2014-11-26 Thread Mueller-Roemer, Johannes Sebastian
No, the quoted text is absolutely correct. If you were to do add_executable(exec ${srcs}) target_link_libraries(exec big) A and B would be linked in automatically, as CMake tracks the link dependencies, just as the quote states. This does not mean that libbig.a contains libA.a and libB.a, only

Re: [CMake] Creating a library from subdirectories

2014-11-26 Thread Chris Johnson
I know that one cannot link static libraries together; they're just archives of objects, really. But since CMake abstracts the actual construction of the library, it could conceivably know how to do the right thing and collect all the needed objects recursively, as it appears to do for executables

[CMake] out-of-tree buildable libraries and find_package

2014-11-26 Thread Mueller-Roemer, Johannes Sebastian
I have a project which uses a number of libraries, a bit like this: CMakeLists.txt -> add_subdirectories, add_executable Lib1 -> add_library Lib2 -> add_library, links to/uses Lib1 As the libraries are individually useful I'd like to keep them individually buildable (i.e., out-of-tree). Obviousl

Re: [CMake] Creating a library from subdirectories

2014-11-26 Thread Mueller-Roemer, Johannes Sebastian
Sorry overread the last point in your mail. I don’t believe there is a way to avoid this directly. What you seem to want is what Xcode calls a prelinked library (http://cocoadev.com/SingleObjectPrelink) . CMake does not have such an option as far as I know -- Johannes S. Mueller-Roemer, MSc Wis

Re: [CMake] Creating a library from subdirectories

2014-11-26 Thread Mueller-Roemer, Johannes Sebastian
In the example on that site an OBJECT library is created (the output consists of multiple .obj files), you used STATIC libraries instead (which each output a single .lib) -- Johannes S. Mueller-Roemer, MSc Wiss. Mitarbeiter - Interactive Engineering Technologies (IET) Fraunhofer-Institut für Gr