On 2014-02-28 05:47, Shobhit Shrivastava wrote:
I am working on creating an SDK from an existing product's code base and use it as an independent static library. The issue I am facing is that the older product, let's say MM, used to link with all the dependencies in the executable but I have to provide one monolith SDK lib that contains all its dependencies within itself. I have struggled but couldn't find the way to achieve that in CMAKE.
I'm not sure if it is possible in CMake to produce a static library that contains the objects from other static libraries. (I'm not even 100% sure it's possible in general, on Windows... I believe with AR-type libraries you could unpack the dependencies and repack their contents into your own library. Ugly, but doable.)
However, if your downstream is also using CMake, you shouldn't need to; just provide exported targets for "MM" and make sure that the interface link libraries for "MMlib" include all of its dependencies. CMake will then take care that anything linking to "MMlib" will also pick up the interface dependencies.
set_target_properties( MMLib PROPERTIES LINK_FLAGS "/LIBPATH:Path_To_MM3PLib1" )
Don't do this; it's not portable. Set the interface link libraries instead.
set_target_properties( MMLib PROPERTIES IMPORTED_LOCATION (Path_To_MM3PLib1) )
This won't do what you want; you're telling CMake that the library to link for the "MMLib" target is a third-party target, and not the "MMlib" library.
-- Matthew -- 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: http://www.cmake.org/mailman/listinfo/cmake
