On Tue, 2019-07-02 at 20:44 +0530, vinay kumar Kotegowder wrote:
> Hi Everyone,
> 
> I have a requirement on combining two static library into one.
> Can anyone tell me how can I achieve this?
> 
> Regards,
> Vinay

If you just want to make a library such that linking against that
library links against your two static libraries, you could use an
interface library. Example:

add_library(lib1 STATIC lib1.c)
add_library(lib2 STATIC lib2.c)
add_library(lib1_2 INTERFACE)
target_link_libraries(lib1_2 INTERFACE lib1 lib2)

Note that with this strategy, lib1 and lib2 will still exist as
separate files, but linking against lib1_2 will link against both of
these libraries.

Kyle
-- 

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

Reply via email to