Re: [CMake] Best way to combine generated static libraries into a single static library

2018-09-22 Thread Deniz Bahadir
Am 21.09.2018 um 21:23 schrieb Ke Gao: So I guess in order to include the object-files from a third party static library, the only way would be to first extract it's object-files and then combine them? That is how I understand it, yes. On Fri, Sep 21, 2018 at 12:34 PM Deniz Bahadir

Re: [CMake] Best way to combine generated static libraries into a single static library

2018-09-21 Thread Ke Gao
So I guess in order to include the object-files from a third party static library, the only way would be to first extract it's object-files and then combine them? On Fri, Sep 21, 2018 at 12:34 PM Deniz Bahadir wrote: > Am 21.09.2018 um 18:38 schrieb Ke Gao: > > Hi David, > > > > It didn't give m

Re: [CMake] Best way to combine generated static libraries into a single static library

2018-09-21 Thread Deniz Bahadir
Am 21.09.2018 um 18:38 schrieb Ke Gao: Hi David, It didn't give me error info. It can produce the final static library, but the contents of third party static libraries are not included. Some clarification regarding STATIC and OBJECT library targets and how they interact with each other usin

Re: [CMake] Best way to combine generated static libraries into a single static library

2018-09-21 Thread Ke Gao
Hi David, It didn't give me error info. It can produce the final static library, but the contents of third party static libraries are not included. Also, sorry for the mistake I have made in my previous email. Deniz is right, the keyword "PUBLIC" should be used in target_link_librarie(). Thanks

Re: [CMake] Best way to combine generated static libraries into a single static library

2018-09-21 Thread David Jobet
Hello, glad that could help you. For your newer problem, you don't describe them, so it's tough to know what kind of problems you're facing. Maybe a small example of your CMakeLists.txt + a capture of the error cmake gives you could help ? David On Fri, Sep 21, 2018 at 4:52 PM Ke Gao wrote: > >

Re: [CMake] Best way to combine generated static libraries into a single static library

2018-09-21 Thread Ke Gao
Thank you all for the help. I finally use a way quite similar to David's first approach. I first generate all sub-projects into object libraries using add_library(lib1 OBJECT SOURCES). Then in the final library, I use add_library(single_static_lib STATIC SOURCES) and target_link_libraries( single_

Re: [CMake] Best way to combine generated static libraries into a single static library

2018-09-21 Thread Deniz Bahadir
Am 21.09.2018 um 09:33 schrieb David Jobet: Hello, I had a similar issue lately and wanted to "pack" several static libs into a dynamic one. (Not even talking about an INTERFACE lib since I really wanted that .so) I made it work with 3 different solutions, none of them being "clean" from my poin

Re: [CMake] Best way to combine generated static libraries into a single static library

2018-09-21 Thread David Jobet
Hello, I had a similar issue lately and wanted to "pack" several static libs into a dynamic one. (Not even talking about an INTERFACE lib since I really wanted that .so) I made it work with 3 different solutions, none of them being "clean" from my point of view. 1- OBJECT libs on sub projects : a

[CMake] Best way to combine generated static libraries into a single static library

2018-09-20 Thread Ke Gao
Hi, I have a project which includes many sub-projects. Each sub-project generates a static library. In the main project, I want to combine the generated objs, generated static libraries from other sub-projects, and some other third party static libraries together into a single static library. Is t