You are unfortunately out of luck here. CMake does not provide built in functionality to create "fat" static libs (multiple static libs combined). Visual Studio allows this quite easily but CMake does not. All static libs are considered transitive dependencies and get carried through to executable and shared libs, they cannot be combined into a single static lib target using the normal add_library and target_link_libraries calls.
It is possible to get a fat lib but you will have to use custom targets and look into running the archiver directly (see CMAKE_AR). I did this once upon a time and ran into a bunch of problems because I needed a cross-platform solution. Things like [1] will get you down the right path of using a custom target to get this to work. -Caleb [1] https://stackoverflow.com/questions/14199708/cmake-include-library-dependencies-in-static-lib On Tue, May 15, 2018 at 3:44 PM, Ritesh Singh <rinkuwithsi...@gmail.com> wrote: > Hi, > > I am creating a static library which in turn depends on several other > libraries. So on Windows in Visual studio for my master library I have > updated Librarian section of project properties to add the other libraries > as additional dependencies. If I update Librarian section manually then I > am able to create the master library successfully, but I am not able to > figure out how to update Librarian from cmake. Now I want to do same > thing using the cmake, I tried several options but nothing worked yet. > > Any help would be appreciated. > > I have posted these couple of questions and still waiting for the response: > > How to update Librarian section of project properties for a Visual studio > project using cmake? > https://stackoverflow.com/q/50346060/2657912?sem=2 > > CMake not linking static library to other static libraries > https://stackoverflow.com/q/50341118/2657912?sem=2 > > Thank you! > > Regards, > Ritesh > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at http://www.kitware.com/ > opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > https://cmake.org/mailman/listinfo/cmake > > -- J. Caleb Wherry *Scientific Software Engineer* <http://www.calebwherry.com> http://www.calebwherry.com +1 (615) 708-5651 calebwhe...@gmail.com
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake