Linking multiple static .lib files into one monolithic .lib file using VS2008 SP1 using CMake 2.8.x

…衆ロ難τιáo~ 提交于 2019-11-28 08:44:12

Create a static library "merged" with a dummy source file, and add libs to be merged to the STATIC_LIBRARY_FLAGS, so they will be additional input to lib.exe.

This would be something like:

ADD_LIBRARY(merged STATIC dummy.c)

SET_TARGET_PROPERTIES(merged PROPERTIES
STATIC_LIBRARY_FLAGS "full\path\to\lib1.lib full\path\to\lib2.lib")

This approach is used inside MySQL, there is a more general macro here to merge static libraries that works crosss-platform. It can be found here http://www.mail-archive.com/cmake@cmake.org/msg28670/libutils.cmake

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!